Feature request: one-statement functions without brackets

Lionello Lunesu lio at lunesu.remove.com
Mon Apr 2 02:29:32 PDT 2007


Downs wrote:
> Feature request: Allow functions of the form function-declaration 
> statement;
> Example: int test() return 5;
> 
> This would make the function syntax closer to the way if/else, while, 
> for and similar
> statements' blocks are handled now, potentially making parsing easier. 
> It would
> also help with internal consistency.
> Also, it would allow methods like void test() synchronized(this) { }, 
> which to me just
> looks cleaner than using brackets to contain a single statement.

I never thought of this, or needed this, but it makes sense though. let 
{ } be used for grouping statements. Nice.

L.



More information about the Digitalmars-d mailing list