Parenthesis
Wolven
rma at wolven.net
Fri Dec 22 13:02:22 PST 2006
== Quote from Gregor Richards (Richards at codu.org)'s article
> 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
"Elegance" is in the eyes of the beholder... I agree with the original poster.
All the meaningless (or not really necessary) parenthesis are, in my eyes,
hideous. Along with the curly braces, and other C style syntax. I'm sure
shorthand looks "elegant", to those that read and write it. To the rest of us, it
looks like scribbling... much like C style syntax. Of course, I'll at least admit
I'm biased.
More information about the Digitalmars-d
mailing list