www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: duck!

It would be ironic to call it go instead of duck. 
- it helps memorizing what it does 
- it's a funny reminder of the Go vs Go! naming issue with D template
instanciation (!)
- "we can do that, with templates"

 auto d = go!Drawable(c); // awes

Andrei Alexandrescu Wrote:
 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!

Oct 18 2010