duck!

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Oct 15 13:52:57 PDT 2010


On 10/15/10 15:46 CDT, Nick Sabalausky wrote:
> "Andrei Alexandrescu"<SeeWebsiteForEmail at erdani.org>  wrote in message
> news:i9ae2n$k9g$1 at digitalmars.com...
>> I was talking to Walter about Kenji's adaptTo. We both think it's a very
>> powerful enabler, but adaptTo is a bland name. After discussing a few
>> marketing strategies, I proposed "duck". It's short, simple, and evokes
>> "duck typing".
>>
>> class C
>> {
>>      int draw(){ return 10; }
>> }
>> interface Drawable
>> {
>>      long draw();
>> }
>> ...
>> auto c = new C;
>> auto d = duck!Drawable(c); // awes
>>
>> Kenji, I'll be looking forward to your submission :o). Would be great to
>> allow structs to duck, too!
>>
>
> Now that's one breed of duck I *can* get behind. Provides the duck benefits,
> but without accidentally conflating naming with semantics everywhere like
> the Ruby/Python ducks or even like Go's "spaghetti door" ducks (
> http://www.reddit.com/r/programming/comments/dr6r4/talk_by_rob_pike_the_expressiveness_of_go_pdf/c12bi4h )
> . Cool stuff.

My opinion: when properly generalized, duck will eat Go's lunch. You 
didn't hear it from me.

Andrei


More information about the Digitalmars-d mailing list