Skip to content
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

[container.requirements] Fix malformed Result specifications #6824

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Eisenwave
Copy link
Contributor

The Result specifications for a.front(), a.back(), a[n], and a.at(n) are formatted as:

reference; const_reference for constant a.

In other words, the result of a.front() is the C++ type reference; const_reference in the event that a is constant. Otherwise, the standard imposes no requirements on the result type of the expression.

Seeing that reference; const_reference cannot be a type and that it would be surprising if no requirements were imposed on non-const a, this is presumably an editorial issue and should be rephrased.

@Eisenwave
Copy link
Contributor Author

Looking at [container.requirements] as a whole, there are a number of other places where this pattern appears, and those may also be worth fixing.

@AlisdairM
Copy link
Contributor

It is clearly an issue that the semi-colon was not intended to be in code font. I think the rewording might bring more clarity too, but suggest retaining the (non-code-font) semicolons rather than switching to commas.

@jwakely
Copy link
Member

jwakely commented Feb 25, 2024

I think those semi-colons should not have been in code font. But it would be clearer if subtle changes in font didn't affect the meaning.

@Eisenwave
Copy link
Contributor Author

@jwakely so specifically, what do you recommend for this PR? I think I agree with @AlisdairM and the commas should remain semicolons, but the rest of the changes are solid.

@Eisenwave
Copy link
Contributor Author

I've now applied respective changes in other portions of containers.tex. The only one that puts \tcode around the wrong thing was [sequence.reqmts].

However, as Jonathan has said, it would be clearer if changes in font didn't affect the meaning. The change applies the following scheme everywhere:

-A; B if x is constant.
+B if x is constant; A otherwise.

@jwakely
Copy link
Member

jwakely commented Feb 26, 2024

I don't think "is constant" is a defined term. Does it mean a constant expression? Constant-initialized? What we mean is that its type is const. The existing "for constant a" isn't much better, but if we're going to change these paragraphs, I think we should fix that not perpetuate it. Or we could just fix the code font semi-colons for now, as a minimal fix.

Copy link
Member

@jwakely jwakely left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the change, but the commit log should be [container.requirements], as it touches more than just sequence containers.

@Eisenwave Eisenwave changed the title [sequence.reqmts] Fix malformed Result specifications [container.requirements] Fix malformed Result specifications Mar 1, 2024
@Eisenwave
Copy link
Contributor Author

I assume the commits history will have to be squashed or something at the end.

Also, I was unable to fix the overfull hboxes here with anything but \\. It's strange that the line wasn't broken automatically.

@tkoeppe
Copy link
Contributor

tkoeppe commented Apr 16, 2024

Could you please rebase, and squash the changes to prevent overful hboxes to wherever they are needed: each commit should individually pass the checks.

[container.reqmts] Prevent semicolon font from altering semantics

[container.rev.reqmts] Prevent semicolon font from altering semantics

[associative.reqmts.general] Prevent semicolon font from altering semantics

[unord.req.general] Prevent semicolon font from altering semantics

[container.requirements] Replace 'is constant' with 'is const'

[container.requirements] Replace 'is const' with 'is of type const X'

[container.requirements] Fix overfull hboxes
@Eisenwave
Copy link
Contributor Author

@tkoeppe done. I presume that it's fine for the long commit message to contain the info about which commits it's been squashed from. Otherwise I can still clean that up.

Copy link
Member

@jensmaurer jensmaurer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good.

Please do remove the long comments from the commit text; they don't help. And force-push. If you wish to spend a sentence explaining some details of the change, that'S fine in the commit text.

\tcode{pair<const_iterator, const_iterator>} for constant \tcode{b}.
\tcode{pair<const_iterator, const_iterator>}
if \tcode{b} is of type \tcode{const X}; \\
\tcode{pair<iterator, iterator>}~otherwise.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please drop the ~ line-break prevention.

Instead of \\, can you add a hyphenation hint \- in a suitable position?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants