On Fri, 2004-02-13 at 11:02, Aaron Sherman wrote: > On Thu, 2004-02-12 at 14:03, chromatic wrote:
> > The easy answer is that interfaces completely suck while traits don't. > > :) > Ok, so what you're saying is that they're solving for exactly the same > thing, but you don't like the Java implementation. Yes and no. I don't think Java interfaces actually solve anything except "let's not change the bytecode spec *again*". At least they acknowledge that single-inheritance isn't the be-all end-all of objects, but the second wrongest way to improve polymorphism is to add a second type of polymorphism with a separate implementation, philosophy, and syntax. The first, of course, is just to ignore the problem. The right way to improve polymorphism is to find common ground between inheritance, delegation, composition, aggregation, and reimplementation, make that your baseline, and support those techniques equally well. That has implications for the type system, the core libraries, and method dispatch, so it's much harder than copying an existing language and throwing out the parts you don't like. Then again, many things that are difficult are worth doing. -- c