Parenthesis

Gregor Richards Richards at codu.org
Fri Dec 22 09:08:31 PST 2006


NN wrote:
> What about removing unuseful parenthesis in 'if', 'for', 'while' ?
> E.g. instead of:
> if(a == b)
> {
>   while(c)
>   {
>      ...
>   }
> }
> We can write:
> if a == b
> {
>   while c
>   {
>      ...
>   }
> }

Does anybody have a spoon I can stab into my eyes? Thanks.

> 
> If someone writes parenthesis the code will compile too.
> So this is almost backwards compatible feature.

And with only the price of making elegant code become inelegant, ugly 
code! Fantastic!

> 
> What about 'if' with one expression ?
> Almost everyone writes curly brackets for more than one expression, so there they will be always written, and there will be no bugs.

... what? Most people write curly brackets if they have more than one 
/statement/ (that's the word you're looking for), but with only one 
simple statement I'd say it's more like a 50-50 split.

  - Gregor Richards



More information about the Digitalmars-d mailing list