dynamic classes and duck typing

Bill Baxter wbaxter at gmail.com
Tue Dec 1 11:52:30 PST 2009


On Tue, Dec 1, 2009 at 11:43 AM, Don <nospam at nospam.com> wrote:
> Bill Baxter wrote:
>>
>> On Tue, Dec 1, 2009 at 5:18 AM, Lutger <lutger.blijdestijn at gmail.com>
>> wrote:
>>>
>>> Ary Borenszweig wrote:
>
>>>>>>>> The feature isn't very dynamic since the dispatch rules are defined
>>>>>>>> statically. The only thing you can do is rewire the associative
>
>>> I don't get it, what if WhatTypeToPutHere does a dynamic lookup, then
>>> it's
>>> pretty much the same a Javascript isn't it? Except that everything in
>>> Javascript does dynamic lookup and in D you are restricted to types that
>>> have this dynamic lookup (which, pending a phobos solution you have to
>>> code
>>> yourself). Do you mean to say this 'except' is the obstacle somehow?
>>>
>
>>> How is that less dynamic? You would be able to call or even redefine at
>>> runtime, for example, signals defined in xml files used to build gui
>>> components.
>>
>> It is a bit less dynamic because in D it's all done with templates.
>
> It's a helluva lot more dynamic in D because it can do code generation on
> request. The "dynamic" bit in Javascript is really an AA lookup, +
> reflection.

But that's code generation /at compile time/.
You can call that "more dynamic" if you like, but it seems to fall
more in the realm of what is considered "static" to me.
Doesn't mean it's not really useful, but calling it dynamic seems to
be stretching the traditional definition a bit too far.

--bb



More information about the Digitalmars-d mailing list