Possible enhancement: Concise return statements

bearophile bearophileHUGS at lycos.com
Mon Aug 15 14:12:20 PDT 2011


Steven Schveighoffer:

> What is going to happen if someone adds an extra ';' ?  Compiler error  
> ("no return statement")

A specific syntax, usable just for delegates that are not void seems to solve some problems:

{ a => a * foo(a) } // OK
{ a, b => a * b } // OK
{ int a, int b => a * b } // OK
{ a => a * 6; }  // syntax error
{ a => return a * 6 }  // syntax error
{ a, b => a *= 6; a * b }  // syntax error?

Bye,
bearophile


More information about the Digitalmars-d mailing list