DMD 0.166 release

Russ Lewis spamhole-2001-07-16 at deming-os.org
Fri Sep 1 09:48:56 PDT 2006


Walter Bright wrote:
> Russ Lewis wrote:
> 
>> Ah, I was wondering if that was what you meant.  What I was suggesting 
>> was that the code
>>     lazy x+y
>> would just be syntax sugar for
>>     delegate int() { return x+y; }
>>
>> So, to expand on the previous example:
>>   void foo(int delegate() dg) {...}
>>   void foo(int i) {...}
>>   void bar(int x,int y) {
>>     foo(lazy x+y); // calls delegate version
>>     foo(x+y);      // calls int version
>>   }
> 
> Ok, that can work. But I don't see an application for it.

Heh, sems like I'm having a lot of trouble explaining myself here.

I'm not trying to argue that overloading a function with both delegate 
and literal versions has a lot of value.  I was just trying to say that 
the syntax I was proposing was not ambiguous.

My argument is that it would be good to make laziness explicit in the 
caller, so that the caller of the code knows what he can expect.



More information about the Digitalmars-d-announce mailing list