Parenthesis
Kristian Kilpi
kjkilpi at gmail.com
Sat Dec 23 01:10:32 PST 2006
On Sat, 23 Dec 2006 04:25:09 +0200, Kevin Bealer <kevinbealer at gmail.com>
wrote:
> Others have commented on aesthetics. I think the real problem is the
> syntax.
> Dropping the parenthesis makes it ambiguous.
>
> if a == b * c - d;
>
> is it:
>
> if (a == b * c) { - d };
>
> or
>
> if (a == b) { * c - d };
>
> Kevin
So, if one chooses not to use the parenthesis, (s)he must use the braces.
Or, a new keyword 'then' (e.g. "if a == b * c - d then")... Errr...
Ok, how the following is interpreted (assuming the parenthesis are
optional and 'then' is not used)?
if (a + 1) * c {...}
->
if((a + 1) * c) {...}
or
if(a + 1) {* c} {...}
... maybe we should stick with the original parenthesis syntax... ;)
More information about the Digitalmars-d
mailing list