On Thu, 2004-02-12 at 05:52, Aaron Sherman wrote: > Perhaps I'm slow, but I don't see the difference between a trait and a > Java interface other than the fact that traits appear to be more of a > run-time construct.
The easy answer is that interfaces completely suck while traits don't. :) Seriously though, Java interfaces add an alternate type system with an alternate syntax for querying. They also don't allow any sort of reasonable code re-use. Effectively, they're abstract multiply-inheritable base classes with a different name because "Multiple Inheritance Is Bad!" On a conceptual level, the different syntax is the worst crime because it reinforces the idea that the important question about an object is "What is this object's position in a class hierarchy?", not "Does this object have the same semantic meaning for these operations as I expect it to have?" Then again, I usually explain it in terms of "sucks", not "don't even acknowledge the real problem". -- c