Rant after trying Rust a bit

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 24 11:30:47 PDT 2015


On 7/24/2015 7:50 AM, jmh530 wrote:
> I'm a little confused here. I seem to be of the belief that D's interfaces can
> accomplish virtually the same thing as Rust's traits. In your example, if the
> type you pass to foo also inherits from hasColor, then it shouldn't be a problem.

As I replied earlier,

"It's a good question. And the answer is, the top level function does not list 
every interface used by the call tree. Nested function calls test at runtime if 
a particular interface is supported by an object, using dynamic casting or 
QueryInterface() calls. It's fundamentally different from traits and concepts."



More information about the Digitalmars-d mailing list