Lambda syntax, etc

BCS ao at pathlink.com
Thu Feb 5 14:02:40 PST 2009


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.





More information about the Digitalmars-d mailing list