Rant after trying Rust a bit

Tobias Müller via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 23 12:50:24 PDT 2015


Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> On 7/23/15 5:07 AM, Walter Bright wrote:
Turns out many constraints in Phobos are of the form (A || B),
>> not just (A && B).
> 
> Agreed. And that's just scratching the surface.
> 
> Serious question: how do you express in Rust that a type implements one
> trait or another, then figure out statically which?

You define a new trait and implement it differently for A and B.
That leads to a cleaner design IMO because you have to think about the
right abstraction for that trait.

TBH I'm very surprised about that argument, because boolean conditions with
version() were dimissed for exactly that reason.

Tobi


More information about the Digitalmars-d mailing list