Re: [JS-internals] C++ coding style rule for keeping class fields together

2017-09-28 Thread Andrew Sutherland
On Thu, Sep 28, 2017, at 08:51 PM, Nicholas Nethercote wrote: > I sometimes want to know the memory layout of a class/struct. Having all > the fields together makes that a *lot* easier. Note that gdb's ptype command can help with this using "/m" which avoids printing methods. (And of course one

Re: [JS-internals] C++ coding style rule for keeping class fields together

2017-09-28 Thread Nicholas Nethercote
I sometimes want to know the memory layout of a class/struct. Having all the fields together makes that a *lot* easier. Nick On Fri, Sep 29, 2017 at 5:35 AM, Jason Orendorff wrote: > On Thu, Sep 28, 2017 at 2:10 AM, Lars Hansen wrote: > > > I

Re: [JS-internals] C++ coding style rule for keeping class fields together

2017-09-28 Thread Jason Orendorff
On Thu, Sep 28, 2017 at 2:10 AM, Lars Hansen wrote: > I dislike this proposal. (a) A lot of the code I work with already have > fields-at-the-beginning as the predominant pattern in the smaller classes > (jit, wasm) so this would be major churn for no gain. (b) For large >

Re: [JS-internals] C++ coding style rule for keeping class fields together

2017-09-28 Thread Benjamin Bouvier
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 >>

Re: [JS-internals] C++ coding style rule for keeping class fields together

2017-09-28 Thread 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

Re: [JS-internals] C++ coding style rule for keeping class fields together

2017-09-28 Thread Jim Blandy
On Thu, Sep 28, 2017 at 12:10 AM, Lars Hansen wrote: > (a) A lot of the code I work with already have > fields-at-the-beginning as the predominant pattern in the smaller classes > (jit, wasm) so this would be major churn for no gain. I think changing the proposal to allow

Re: [JS-internals] C++ coding style rule for keeping class fields together

2017-09-28 Thread Luke Wagner
I don't have an opinion on at-top vs. at-bottom and churn vs. benefits of regularity, but I do really dislike it when fields are mixed with methods. I often like to know I've seen everything so I can feel like I have a handle on the whole state machine of the class and for this purpose I find it

Re: [JS-internals] C++ coding style rule for keeping class fields together

2017-09-28 Thread Benjamin Bouvier
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"). 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