On Thu, Sep 28, 2017 at 9:35 PM, 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
>> classes this is an anti-pattern, like having all the vars at the beginning
>> of a function in C; it separates the data from the functions that work on
>> that data. (c) It brings private and public parts of the code close
>> together, and separates public data from public methods.
> Objections (a) and (b) make sense to me, so let's make the rule "For
> reasonable-sized classes, put all the fields together, at the top
> (immediately after any necessary typedefs). For unreasonably large classes,
> do whatever seems best (but let's try to avoid making more of these)."
> I don't really understand objection (c); maybe an example from SM code
> would clear it up. (But let me grant in advance that all style rules are
> subordinate to George Orwell's sixth rule: "Break any of these rules sooner
> than say anything outright barbarous.")
I admit this is a more generic concern. When I write code that is part of
a module API I like to separate the public bits from the private bits and I
usually do this textually (public members and methods at the top; private
at the bottom) since C++ pretty much forces me to add the private bits to
the publically visible class definition unless I want to jump through a lot
of hoops to hide them and pay the cost of virtual methods.
, still misses Modula-3's partial revelations