New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistent vertical spacing for access modifiers in [ranges] #4704
Comments
FWIW, I find this inconsistency quite annoying: do we really believe that a significant proportion of readers understand that |
@CaseyCarter: Do you mean the inconsistent ways we use |
The way I see it is that predominantly the Standard is about the public interfaces, so we present the public parts "by default": that means no explicit specifers for |
It's a small nit not worth fighting over, but I think |
We also sometimes have Some of the new range view classes have very verbose private sections, and I'm even tempted to try out more internal vertical whitespace, e.g. newlines between items which each have long comments, long requires clauses, and long comments like "enabled only if Foo". It's getting very dense and crowded. Once you imagine taking up more space overall, explicit section markers might be useful for quick orientation. I'm ultimately not decided between either style yet, but do we agree at least that we should pick one? |
Consistency is good. For starters, I think "structs with private members" should be turned into classes right away. And, if we're not doing this already, an empty line before an access-specifier is a good idea. Also, moving the "exposition only" comment more to the right also de-crowds the presentation. |
The latter.
Here we're going to disagree. To me, the standard library specification is primarily concerned with behavior; how things act is more important than how they look. The specifications of the public and private (or exposition-only, which should be synonymous) parts of a given class are equally important for conveying the intended behavior. Your argument is a good one for the content of header files in an actual C++ project which the standard's synopses are not: we don't specify truly private implementation details at all. That said, I've expressed my dissenting opinion and I'm now happy to stop arguing the issue =)
Yes, absolutely. I wish I'd understood how the library specifies things and appreciated the value consistency in large projects as much then as I do now.
It seems silly that we have to comment every private member of every standard library class with |
Re blanket wording / expos comments: That's something we could certainly consider. |
This is a slightly inopportune moment to discuss this. I'd much prefer if we'd apply any pending editorial fixes that are low-risk and can go in before the mailing, and then ship the updated Working Draft. The discussion here needs some ideas, thinking, and discussion, none of which are on the plate right now. |
Editorial meeting 2021-06-18: Move all private parts (in particular non-static data members) to the bottom as much as possible. Maybe all that remains are nested class types with a nice "// cross-ref" introducer. Leave the rest as-is for now. |
We currently often don't have any blank lines between
private:
andpublic:
parts, especially in [ranges].We're also inconsistent between
class X { stuff;
andclass X { private: stuff;
.I propose the following, to be added to the editorial wiki:
class
. If a private section is needed at the beginning, that means we sayclass { private:
.The text was updated successfully, but these errors were encountered: