Rant after trying Rust a bit

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 23 02:07:56 PDT 2015


On 7/22/2015 11:47 PM, Jacob Carlborg wrote:
> On 2015-07-22 20:47, simendsjo wrote:
>
>> Traits
>> ------
>> I think the ability to express an interface without buying into
>> inheritance is the right move. The alternative in D is specifying the
>> behavior as a template
>
> I completely agree and don't really like the approach D has implemented template
> constraints. Yeah I know, Andrei will destroy this :)

Consider that template constraints can be arbitrarily complex, and can even 
check behavior, not just a list of function signatures ANDed together. Turns out 
many constraints in Phobos are of the form (A || B), not just (A && B).


 >> and verifying the contract in a unittest for the type.

I am a bit puzzled by the notion of shipping template code that has never been 
instantiated as being a positive thing. This has also turned up in the C++ 
static_if discussions.


More information about the Digitalmars-d mailing list