DMD 0.166 release
Sean Kelly
sean at f4.ca
Fri Sep 1 10:24:46 PDT 2006
Russ Lewis wrote:
> 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.
I believe this is the same as Derek's suggestion that in/out/inout be
specified at the call side as well.
Sean
More information about the Digitalmars-d-announce
mailing list