On 1/6/14, 3:35 PM, Daniel Holbert wrote:
On 01/06/2014 03:10 PM, Karl Tomlinson wrote:
Martin Thomson writes:
I would like to think that adding (or removing) braces from block statements
should be acceptable.
I would argue that braces should not be added with automation.
When debugging code, it is important to understand the intent of
the author. Adding braces at parser-determined points disguises
the intent.
I agree with karl. Automated insertion of braces could easily hide bugs.
e.g. consider this buggy code:
if (condition)
foo();
bar();
If we allow a tool to automatically place braces around "foo()", then
that won't change behavior, but it will hide the fact that the author
*meant* for both foo() and bar() to be inside the block.
I think you just gave an example of why our tooling needs to identify
poorly formatted code better. An "if" without a brace followed by
multiple indented lines containing compiler expressions is a bug at
worst or unreadable/unclear code at best. We could, of course, identify
such poor style before any automated style conversion. In any case,
looking at a file revision from before the automated brace insertion
would clearly reveal the author's [likely] intent. I therefore fail to
see your concern here.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform