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

[swappable.requirements] Requires should now be Preconditions #4886

Merged
merged 3 commits into from Sep 25, 2021

Conversation

brevzin
Copy link
Contributor

@brevzin brevzin commented Sep 9, 2021

No description provided.

source/lib-intro.tex Outdated Show resolved Hide resolved
@tkoeppe tkoeppe self-requested a review September 9, 2021 15:27
@jensmaurer
Copy link
Member

When merging, fix the commit message to mention the section label.

@@ -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)}.
Copy link
Contributor

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.)

Copy link
Contributor

Choose a reason for hiding this comment

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

How about "requires:"? :-)

Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor

@JohelEGP JohelEGP left a 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.

@brevzin brevzin changed the title Requires should now be Mandates [swappable.requirements] Requires should now be Preconditions Sep 25, 2021
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.

This needs to be squashed and the commit message needs to be repaired.

@jensmaurer
Copy link
Member

@tkoeppe, this looks good now.

@tkoeppe
Copy link
Contributor

tkoeppe commented Sep 25, 2021

Yes, I thought I'd let @timsong-cpp take a final look.

@tkoeppe tkoeppe merged commit 7a2e73d into cplusplus:main Sep 25, 2021
@brevzin brevzin deleted the requires-2-mandates branch September 25, 2021 19:59
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

7 participants