Fully dynamic d by opDotExp overloading

Steven Schveighoffer schveiguy at yahoo.com
Sat Apr 18 18:40:32 PDT 2009


On Sat, 18 Apr 2009 21:10:27 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> Adam Burton wrote:
>> Andrei Alexandrescu wrote:
>>>> What about using something like '->' for dynamic calls instead of '.'?
>>> That's absolutely useless. If I have to write anything different from
>>> "." I might as well write "bloodyMaryBloodyMaryBloodyMary".
>>>
>>> Andrei
>> You could even write 'noodles' but that doesn't really give me a reason  
>> as to why it's absolutely useless. Please clarify, I thought it seemed  
>> like a reasonable idea, if it isn't I would like to know why.
>
> I apologize for the snapping. There's no excuse really, but let me  
> mention that this thread has been particularly meandering.
>
> The point of using "." is not syntactic convenience as much as the  
> ability of the Dynamic structure to work out of the box with algorithms  
> that use the standard notation.

Hm... the thought just occurred to me.

At what time are you going to use opDotExp so an entity be used in an  
algorithm rather than actually defining the functions directly?  For  
example, if you want to make a class/struct a range, why not just define  
the functions directly?  It seems odd to define them using opDotExp.

I can only see usages of either when you want to bind to dynamic data  
(e.g. fields in a database row) or when you want to define a vast number  
of functions where only a few will be used (i.e. Pascalize or swizzle  
example).

I'm not saying there aren't such usages, I just can't think of any myself.

-Steve



More information about the Digitalmars-d mailing list