From:  Andrew McCreight <amccreight@mozilla.com>
Date:  28 Sep 2017 00:36:05 Hong Kong Time
Newsgroup:  news.mozilla.org/mozilla.dev.tech.js-engine.internals
Subject:  

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

NNTP-Posting-Host:  63.245.214.181

On Wed, Sep 27, 2017 at 9:18 AM, Jason Orendorff 
wrote:

> Hi everyone.
>
> I'd like to add a style rule: in a struct/class/union, put all the fields
> (that is, non-static member variables) together, at the end.
>
> Maybe this is dumb, but while working with Rust I got used to this. Rust
> doesn't allow methods to be defined within a struct or enum. And wow is it
> easier to see what's going on. "Show me your tables..." and all that.
>
> (At the end is better than at the top because you *can't* always put all
> the fields together at the top. Sometimes you have to declare a type first.
> Sometimes it's a nested class that's rather a lot of code.)
>
> If nobody objects in a day or two, I'll add the new rule here:
> https://wiki.mozilla.org/JavaScript:SpiderMonkey:Coding_Style


For what it is worth, this is the style that a lot of Gecko code informally
follows, and I find it very useful.



>
> -j
> _______________________________________________
> dev-tech-js-engine-internals mailing list
> dev-tech-js-engine-internals@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals
>