From:  Bobby Holley <>
Date:  05 Sep 2018 00:48:43 Hong Kong Time

Re: Proposal: always use braces for if/for/while statements



The one downside of doing this now is that we'll eventually do another bulk
reformat of all of mozilla-central once we settle on a clang-format
version+config whose output we're happy with. So if that were to happen
very soon (unlikely), doing piecemeal handling of braces now would result
in extra effort and blame churn that could have been avoided. But since the
clang-format work will probably take a while, switching now will allow new
code to more-closely match long-term style, and allow everyone to get
comfortable with it.


On Tue, Sep 4, 2018 at 7:41 AM Jan de Mooij  wrote:

> Hi all,
> I'd like to propose we change the SpiderMonkey coding style to always brace
> if/for/while statements.
> It matches Gecko's coding style and in the past there has been agreement to
> unify our coding styles as much as possible. Adding unnecessary braces
> often results in style nits when Gecko hackers write SpiderMonkey patches
> (or similarly, missing braces in Gecko code). The situation is worse in
> XPConnect where both styles are used. Also, when to use {} can be pretty
> confusing for people new to SpiderMonkey.
> The downside is that it's more verbose, especially for a file like
> BytecodeEmitter.cpp that has tons of unbraced if-statements (it will add
> about 900-1000 lines to that file).
> The conversion is pretty easy to automate - while waiting for feedback and
> Try results today I wrote a simple script to do this, here's the diff for
> BytecodeEmitter.cpp: -- I still have to review the
> changes more closely (and probably compare the generated object files) but
> overall it looks reasonable.
> Thoughts?
> Thanks,
> Jan
> _______________________________________________
> dev-tech-js-engine-internals mailing list