Rant after trying Rust a bit

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 25 06:20:16 PDT 2015


On 7/24/15 3:26 PM, Walter Bright wrote:
> On 7/24/2015 11:39 AM, Jacob Carlborg wrote:
>> Perhaps it might be good idea to allow to set a predefined version
>> identifier,
>> i.e. set "linux" on Windows just to see that it compiles. Think of it
>> like the
>> "debug" statement can be used as an escape hatch for pure functions.
>
>
> I don't want to encourage "if it compiles, ship it!" I've strongly
> disagreed with the C++ concepts folks on that issue, and they've
> downvoted me to hell on it, too :-)
>
> I get the impression that I'm the only one who thinks exclusive traits
> is more of a problem than a solution. It's deja vu all over again with
> Exception Specifications. So, one of:
>
> 1. I'm dead wrong.
> 2. I fail to explain my argument properly (not the first time that's
> happened, fer sure).
> 3. People strongly want to believe in traits.
> 4. Smart people say it tastes great and is less filling, so there's a
> bandwagon effect.
> 5. The concepts/traits people have done a fantastic job convincing
> people that the emperor is wearing the latest fashion :-)
>
> It's also clear that traits work very well "in the small", i.e. in
> specifications of the feature, presentation slide decks, tutorials, etc.
> Just like Exception Specifications did. It's the complex hierarchies
> where it fell apart.

It would be a mistake to put concepts and traits together. Traits have 
been used at large scale in Scala to great results (my understanding is 
they're similar to Rust's). Scala-style traits would marginally improve 
D but we already have competing mechanisms in the form of template 
constraints. I consider them more powerful; Odersky seems to think 
they're about as powerful. -- Andrei


More information about the Digitalmars-d mailing list