about { expr }syntax for anonymous delegate

kris foo at bar.com
Tue Aug 22 13:18:11 PDT 2006


Sai wrote:
> 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


Sure is better than deliberately introducing ambiguity into the language.



More information about the Digitalmars-d mailing list