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

[utility.requirements] Dismantle requirements tables #6034

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tkoeppe
Copy link
Contributor

@tkoeppe tkoeppe commented Dec 19, 2022

Fixes #6033.

@tkoeppe
Copy link
Contributor Author

tkoeppe commented Dec 19, 2022

@jensmaurer, @Dani-Hub: this is a first draft. I expect we'll want to split some of the text across different elements, and/or use different elements in some places.

@tkoeppe
Copy link
Contributor Author

tkoeppe commented Dec 19, 2022

Comment on lines -1593 to +1650
Tables~\ref{tab:cpp17.equalitycomparable}--\ref{tab:cpp17.destructible}.
In these tables,
subclauses
\ref{utility.req.cpp17.equalitycomparable},
\ref{utility.req.cpp17.lessthancomparable},
\ref{utility.req.cpp17.defaultconstructible},
\ref{utility.req.cpp17.moveconstructible},
\ref{utility.req.cpp17.copyconstructible},
\ref{utility.req.cpp17.moveassignable},
\ref{utility.req.cpp17.copyassignable}, and
\ref{utility.req.cpp17.destructible}.
In those subclauses,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why an explicit list, rather than keeping it as a range? Like on of these:
1671456801
1671456814

@@ -1590,8 +1590,16 @@
\pnum
The template definitions in the \Cpp{} standard library
refer to various named requirements whose details are set out in
Tables~\ref{tab:cpp17.equalitycomparable}--\ref{tab:cpp17.destructible}.
Copy link
Contributor

Choose a reason for hiding this comment

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

Now the tables don't float under this subclause, but rather, are sibling subclauses. Should [utility.requirements.general] be updated to reflect this? Its overview seems to not tell the whole story.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the overview to be exhaustive (using a range of clauses there). I just hadn't got around to it yet.

Copy link
Member

@Dani-Hub Dani-Hub Dec 19, 2022

Choose a reason for hiding this comment

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

Thanks for the work on this. First impressions: Overall change looks good to me, but I realized some problems:

I notice that "Result:" is used to specify statements such as "T t;". This is a novelity and [structure.specifications] (3.7) isn't yet ready to handle this situation. I think we need to extend the definition of Result: elements or possibly use a different element (Remarks: ?) for those cases. @jensmaurer What is your preference?

Some requirements (such as "Cpp17CopyConstructible") which extend other requirements (such as "Cpp17MoveConstructible") denoted by "in addition to" need to be fixed to keep the extension character, this information is currently lost, so we need to restore "requirement refinement" effects, most likely by wording of the form as example: "A type T meets the Cpp17CopyConstructible requirement if it meets the Cpp17MoveConstructible requirements and if the [..]"

It seems that wording forms "decltype(a == b) models boolean-testable" are expressed as Mandates: elements, which means that an implementation has to diagnose it. But modeling a concept includes semantic requirements ([res.on.requirements] p1), so would in general require heroic efforts for an implementation to diagnose this. This is better described by a Precondition: or Remarks: element, I guess (I still need to learn the richness of the new elements). We describe here actually the characteristics of the result, that was the reason why it was originally part of the "Return type" column.

Comment: For Cpp17NullablePointer/Cpp17Hash: Don't we want to dismantle Table 29/30 as well into sub-clause [nullablepointer.requirements]/[hash.requirements]? (I assume this is too early to ask, right?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, Daniel!, great points!

We'll definitely want to dismantle the other requirement tables, too, but I didn't want to bite off too much, esp. as we're all just learning how to best use these new elements.

I hadn't realized that the Copy* requirements are "in addition to" the respective Move* requirments. That's interesting. I wouldn't mind grouping both under simply "Copy/Move construction" and "Assignment", respectively, but then we'd lose the ability to reference each requirement precisely.

Copy link
Member

@Dani-Hub Dani-Hub Dec 19, 2022

Choose a reason for hiding this comment

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

I wouldn't worry to much about the order. My suggested wording form to restore the "in addition to" effects is basically the same approach that we used in the container requirements table, which had the same form and now look as follows
"A type X meets the reversible container requirements if X meets the container requirements, [..]"
I think it is more important to reference them individually.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, that's nice, done!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, the refinement problem seems to be solved here, we still need to fix the Mandates: problem related to boolean-testable. And let's await feedback from @jensmaurer regarding the problem related to the Result: specification of statements.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ive changed the Mandates to Preconditions for now. One thing we can and should definitely consider whenever we break up requirements tables is that we can split an erstwhile requirement into both a Mandates and a Preconditions bit if that makes sense.

Copy link
Member

Choose a reason for hiding this comment

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

While I in general agree with that split suggestion I guess we need a paper for this with LWG nod on it, because the added Mandates: elements not only impose stronger requirements on implementations but also has effects on any programmer taking advantage of these basic requirements sets as part of their own specification. Contrary to some specific requirements tables (Such as those of the container requirements for example), the basic requirements are not short-cuts for actually concrete component specifications.

source/lib-intro.tex Outdated Show resolved Hide resolved
source/lib-intro.tex Outdated Show resolved Hide resolved
source/lib-intro.tex Outdated Show resolved Hide resolved
source/lib-intro.tex Outdated Show resolved Hide resolved
@wg21bot wg21bot added the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs rebase The pull request needs a git rebase to resolve merge conflicts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dismantling requirements tables 29-36
4 participants