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
[swappable.requirements] Requires should now be Preconditions #4886
Conversation
When merging, fix the commit message to mention the section label. |
source/lib-intro.tex
Outdated
@@ -1614,15 +1614,15 @@ | |||
\begin{codeblock} | |||
#include <utility> | |||
|
|||
// Requires: \tcode{std::forward<T>(t)} shall be swappable with \tcode{std::forward<U>(u)}. | |||
// Mandates: \tcode{std::forward<T>(t)} is swappable with \tcode{std::forward<U>(u)}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both "is swappable with" and "swappable" have semantic requirements, violations of which an implementation cannot be expected to diagnose. To be pedantically correct, these comments both need to Mandate the syntactic requirements and Precondition the semantic requirements. (This admittedly feels like overkill for an example - I have no better idea, though.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "requires:"? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TFW you remove a term for being too vague and then complain about having to be too precise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that getting all those requirements right is critical and that this example concerns a presumably very common customization point, it might be worth doing this right.
@brevzin: would you mind adding appropriate "precondition" comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we can just use Preconditions: without Mandates:, which is how we do this elsewhere in the library spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, prefix the [stable.label] to the commit and issue title.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be squashed and the commit message needs to be repaired.
@tkoeppe, this looks good now. |
Yes, I thought I'd let @timsong-cpp take a final look. |
No description provided.