"The last feature": overridable methods in interfaces

Michel Fortin michel.fortin at michelf.com
Mon Feb 8 09:59:33 PST 2010


On 2010-02-08 11:58:53 -0500, retard <re at tard.com.invalid> 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?

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list