From:  Benjamin Bouvier <>
Date:  29 Sep 2017 02:38:27 Hong Kong Time

Re: C++ coding style rule for keeping class fields together


2017-09-28 20:25 GMT+02:00 Jim Blandy :

> On Thu, Sep 28, 2017 at 1:55 AM, Benjamin Bouvier  wrote:
>> Agreed with Lars. In particular regarding (b), I tend to read unknown code
>> by starting with the data (the "what") then look at how it's manipulated
>> (the "how").
> Jason and I are in firm agreement with you about this. We read code the
> same way. (This is Fred Brooks' "show me your tables" line Jason quoted.)
> This is what the proposal is intended to help.
>> This stylistic change would be a huge regression to me, and
>> there are already some places where the fields are grouped at the end,
>> which I've found these very confusing.
> The idea behind Jason's proposal is to put the "what" all together, and
> the "how" all together, to make this easier. Why would this be a regression?

The notable part in my sentence that implied the regression was the "at the
end": I usually read from top to bottom, not the other way around. Anyways,
that's something I could get used to, in the worst case.

Thanks for demystifying the quote! I definitely need to read that copy of
The Mythical Man Month that's been waiting for a few weeks...


> That being said, I agree having the fields grouped is much better than the
>> messes that are JSContext or JSRuntime, sometimes intertwining fields and
>> methods which don't even seem related to the fields defined just before.
> I think JSContext and JSRuntime are special cases. In modern style, global
> variables are verboten, but what we've replaced them with is Structs Passed
> Everywhere. Especially since we removed support for "requests"
> (SpiderMonkey's old concurrency model), JSContext and JSRuntime have
> evolved from having particular meanings to hold whatever state random bits
> of SpiderMonkey need.