JavaScript Concern from a recent review
Gervase Markham
gerv at mozilla.org
Mon Apr 9 09:43:24 UTC 2007
Colin Ogilvie wrote:
> I'm concerned by a recent review Myk did on a JavaScript file (quoted
> above) where he says that for one-line conditionals and loop blocks you
> should omit braces (as a Nit).
>
> I'd like to suggest that this is a bad practice, and possibly going to
> cause confusion in the future, particularly in the example above. For
> clarity, it would be better written including braces.
I would agree with you, and respectfully disagree with Myk. I don't
believe that omitting braces adds to readability. The most it does,
given Bugzilla's current coding style, is save a line. And I don't think
that advantage outweighs the potential mistakes that can be made in
maintenance, and the mental switch required to notice the different
syntax in this special case.
Gerv
More information about the developers
mailing list