Parenthesis
John Demme
me at teqdruid.com
Thu Dec 28 22:17: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
> {
> ...
> }
> }
>
> If someone writes parenthesis the code will compile too.
> So this is almost backwards compatible feature.
>
> 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.
I don't like this idea- parens are a good thing. There is one paren-related
change I'd like to see, though. I'd like to be allowed to put a '!' right
before the parens, so I could do
if !(/*some long expression*/)
foo();
instead of
if (!(/*some long expression*/))
foo();
The extra set of parens always bothered me. Does this create any sort of
ambiguity?
--
~John Demme
me at teqdruid.com
http://www.teqdruid.com/
More information about the Digitalmars-d
mailing list