Lambda syntax, etc

BCS none at anon.com
Wed Feb 4 22:09:53 PST 2009


Hello Nick,

>> One #1 I'd be inclined to requier that the function be defined like
>> 
>>> void DoIt(int delegate(int) dg...)
>>> 
>> D laready has this syntax for Typesafe Variadic Functions
>> http://www.digitalmars.com/d/1.0/function.html
>> 
> I'm not quite convinced either way on this. For what reasons do you
> think the function header should be required to indicate "this uses
> block syntax"? What's wrong with just saying "If the last arg a
> function takes is a delegate, then that delegate can optionally be
> specified with block syntax."?
> 

I have used bare block statements on occasion and a missing ';' in the wrong 
place would be nasty to parse. Another option for killing that problem would 
be to forbid overloading only on a trailing delegate so Foo(int) and Foo(int, 
int delegate()) would be considered ambiguous (that argues for the ... as 
then the rule would be to forbid overloading only on block delegates)





More information about the Digitalmars-d mailing list