DMD 0.166 release

Walter Bright newshound at digitalmars.com
Fri Sep 1 11:03:00 PDT 2006


Sean Kelly wrote:
> 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.

Ok.

>> 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.

Yes, it would be the same. But I think the interface should be set by 
the definition, not the use. That's the usual practice with programming 
languages, and I've never seen it raised as an issue before.



More information about the Digitalmars-d-announce mailing list