duck!

Jimmy Cao jcao219 at gmail.com
Sat Oct 16 12:15:16 PDT 2010


I think it's safe to say this is pretty much duck-typing in D (?)
So then, if duck! is used, it puts emphasis on what the function allows D to
do (duck-typing),
while if as! is used, it sounds more intuitive (kinda like ".respond_to?" in
Ruby) .

So going with my previous statement,
if you keep using duck!, or adaptTo!, or whatever this becomes, it will
eventually stick and will sound intuitive no matter what.
In that way, I think as! is not necessarily such a good choice.

Also, I really agree with Kagamin and Walter's argument, that simply the
name "duck!" would raise awareness for this features.

2010/10/16 so <so at so.do>

> Reading wikipedia, definition and the examples exactly match adaptTo.
> Before naming it, i think we should first be clear about if it is really
> duck-typing or not.
>
>
> On Sat, 16 Oct 2010 21:44:51 +0300, Michel Fortin <
> michel.fortin at michelf.com> wrote:
>
>  On 2010-10-16 14:32:10 -0400, Walter Bright <newshound2 at digitalmars.com>
>> said:
>>
>>  Nobody is going to start using D because it has a function *named* duck.
>>>>
>>>  Maybe not, but it will raise awareness that "D has duck typing".
>>> Otherwise, I guarantee you that people will argue that "I need duck typing,
>>> and Z has it and D does not" if it is named adaptTo.
>>>
>>
>> The problem is that D doesn't have duck-typing. The adapter pattern isn't
>> duck-typing. Duck-typing is when you have an object and can call a 'quack'
>> function on it and if there's no 'quack' function you get a runtime error.
>>
>> It's like saying D is a dynamic language, people will know you're
>> bullshitting them.
>>
>>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20101016/b48ce98d/attachment.html>


More information about the Digitalmars-d mailing list