Feature request: one-statement functions without brackets

Downs default_357-line at yahoo.de
Mon Apr 2 03:25:27 PDT 2007


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 couldn't immediately imagine a case where this syntax might lead to an ambiguity; if
there is, I'm sorry.

  -- awaiting feedback, downs



More information about the Digitalmars-d mailing list