Lambda syntax, etc

Chris Nicholson-Sauls ibisbasenji at gmail.com
Thu Feb 5 22:18:11 PST 2009


Robert Fraser wrote:
> BCS wrote:
>> Reply to Yigal,
>>
>>> Personally I prefer to have syntax for "blocks" like Ruby/smalltalk.
>>> given the following example function:
>>> int func(int a, delegate int(int) dg) { .. }
>>> // call func with [something in this spirit is my favorite]:
>>> func(someInt) { | int a, int b | return a+b; };
>>>
>>
>> how about require that the block arg in the called function name the args
>>
>>> int func(int a, delegate int(int val, int thing) dg) { .. }
>>
>> and then pull in those names implicitly
>>
>>> func(someInt) { return val+thing; };
>>
>> This would have implication in overloading and what not but it would 
>> be syntactically clean.
> 
> Ew, no. Aside from the technical issues, this distances the names from 
> the use thereof (i.e. they'd likely be in separate files)

While I fundamentally agree, it could also be nice to /allow/ the names 
in the decleration, as they may be useful for documentation.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list