about { expr }syntax for anonymous delegate

Sai leo303161 at yahoo.com
Tue Aug 22 13:10:07 PDT 2006


Other people already proposed the { expr } syntax, I liked it too, can't 
we think of it like this ...


We usually write compound statement as:

{
   statement1;
   statement2;
   return expr;
}

We can ignore ';' if there is only statement, so following is valid:

{
   statement
}

{
   return expr
}

If there is only a return statement, and the return type of the delegate 
matches the expression, we can make the 'return' keyword optional:

{
   expr
}


well ... what do you all say ?
(hope Walter likes this)
Sai



More information about the Digitalmars-d mailing list