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

consider reordering Postconditions: library element after Throws: #3612

Open
zygoloid opened this issue Jan 7, 2020 · 6 comments
Open

consider reordering Postconditions: library element after Throws: #3612

zygoloid opened this issue Jan 7, 2020 · 6 comments
Labels
lwg Issue must be reviewed by LWG.

Comments

@zygoloid
Copy link
Member

zygoloid commented Jan 7, 2020

We currently list library descriptive elements in this order (ignoring Requires: on the basis that we're working to remove it):

  • Constraints:
  • Mandates:
  • Preconditions:
  • Effects:
  • Synchronization:
  • Postconditions:
  • Returns:
  • Throws:
  • Complexity:
  • Remarks:
  • Error conditions:

These mostly, but not entirely, have a nice temporal flow to them. First we do overload resolution (Constraints:) to pick a function, then picking that function might give an error (Mandates:). At runtime, we need the Preconditions: to be met, and then the Effects: happen (perhaps with a specified Complexity:), along with perhaps some Synchronization:.

Then the function either Returns: or Throws: (and in so doing, reports any Error conditions:).

Only then (after a return or the absence of a throw) are the Postconditions: fully established.

To make this flow more naturally, we could:

  • Reorder Postconditions: after Throws:
  • Reorder Error conditions: alongside Returns: and Throws:
  • Reorder Complexity: alongside Effects:

We'll need to look at some affected library wording and see if this is actually an improvement in practice, and check with LWG to see if they're happy with this reordering.

@zygoloid zygoloid added lwg Issue must be reviewed by LWG. decision-required A decision of the editorial group (or the Project Editor) is required. labels Jan 7, 2020
@jensmaurer
Copy link
Member

Examples: [syserr.errcode.modifiers] p3, [optional.ctor] p8
Already in the desired order: [optional.assign]

@jensmaurer
Copy link
Member

Editorial meeting: Not for C++20. Revisit at a future meeting.

@jensmaurer
Copy link
Member

Editorial meeting: We like the direction. The reordering can probably be automated. Consult with LWG.

@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label May 28, 2021
@tkoeppe
Copy link
Contributor

tkoeppe commented May 28, 2021

@jwakely: Could you please discuss this issue with LWG and let us know if there is any kind of appetite for any work on reordering the elements?

@jensmaurer
Copy link
Member

@jwakely , ping?

@jwakely
Copy link
Member

jwakely commented Jul 27, 2021

Discussed in the thread starting at https://lists.isocpp.org/lib/2021/06/19518.php

Not many people expressed an opinion but those who did said to go ahead, so please go ahead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lwg Issue must be reviewed by LWG.
Projects
None yet
Development

No branches or pull requests

4 participants