Rant after trying Rust a bit

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 24 15:12:06 PDT 2015


On Friday, 24 July 2015 at 19:10:33 UTC, Walter Bright wrote:
> On 7/24/2015 11:42 AM, Jacob Carlborg wrote:
>> I don't see the difference compared to a regular parameter. If 
>> you don't specify
>> any constraints/traits/whatever it like using "Object" for all 
>> your parameter
>> types in Java.
>
> So constraints then will be an all-or-nothing proposition? I 
> believe that would make them essentially useless.
>
> I suspect I am not getting across the essential point. If I 
> have a call tree, and at the bottom I add a call to interface 
> X, then I have to add a constraint that additionally specifies 
> X on each function up the call tree to the root. That is 
> antiethical to writing generic code, and will prove to be more 
> of a nuisance than an asset.
>
> Exactly what sunk Exception Specifications.

In many language you have an instaceof keyword or something 
similar. You'd get :

if (foo instanceof X) {
   // You can use X insterface on foo.
}

vs

static if (foo instanceof X) {
   // You can use X insterface on foo.
}

The whole runtime vs compile time is essentially an 
implementation detail. The idea is the very same.

The most intriguing part of this conversation is that the 
argument made about unitests and complexity are the very same 
than for dynamic vs strong typing (and there is hard data that 
strong typing is better).

Yet, if someone would make the very same argument in the case of 
dynamic typing, both Walter and Andrei would not give it a second 
though (and rightly so). Yet, nowhere the reason why this differs 
in ay that make the cost/benefit ratio shift is mentioned. It is 
simply asserted as such.



More information about the Digitalmars-d mailing list