Mon, 08 Feb 2010 12:59:33 -0500, Michel Fortin wrote: > On 2010-02-08 11:58:53 -0500, retard <[email protected]> said: > >> Mon, 08 Feb 2010 07:03:43 -0600, Andrei Alexandrescu wrote: >> >>> I think lack of state is indeed the only difference. The multiple >>> inheritance bit makes all the difference, so I think abstract classes >>> are not enough. A designer who wants to define some methods in an >>> interface is forced at design time to choose an abstract class over an >>> interface, thus severely limiting clients. >> >> I really wonder why you're doing this. NIH. Ever heard or Scala and >> traits? I'm sorry, but you didn't invent this feature - giving some >> kind of attribution would be honest. I can imagine how this proposal >> goes forward. Suddenly D 2 gets almost exactly the same feature (+ >> contracts) as Scala has had for a long time and somehow you get all the >> credit in the practical (C++/D) PL community. > > Hum, where did Andrei claimed he invented this? > > To me who knows well Objective-C, this looks like an adaptation to D of > the informal protocol concept, which was then superseded by optional > methods in formal protocols in Objective-C 2.0. This pattern is used a > lot in Objective-C, even though it's implemented differently and is more > powerful due to categories. > > Also, I don't know much about SmallTalk, but given SmallTalk was the > inspiration for Objective-C I wouldn't be surprised to see this there > too. > > It's nice to give attribution, but where do we stop? Can you say you > know for sure what was the real inspiration for this?
No, I don't know the original source. Multiple inheritance is an old and widely known problem. I just meant that instead of bikeshedding here and reinventing everything from scratch, everyone interested in the topic should take a look at Scala's traits since traits basically are interfaces extended with function bodies. Scala also has a solution to the conflicting multiply inherited methods. I just mentioned Scala because it's also a C inspired object oriented language and this feature proposal is more or less 90% the same concept as traits, both syntactically and semantically.
