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

[expr.log.and],[expr.log.or] improve wording symmetry and quality #6574

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

Conversation

Eisenwave
Copy link
Contributor

@Eisenwave Eisenwave commented Sep 20, 2023

The wording for && and || had a number of issues which this PR resolves.

  1. The wording of && and || is oddly asymmetric in a number of places. Specific wording choices like using : in one paragraph, and ; morever, are asymmetric with no good reason.
  2. There are notes regarding & left in normative wording. These are extracted into an actual note.
  3. In both subclauses, the first and second paragraph contain a mixture of describing the result (type) and describing evaluation. This is fixed by clearly separating it so that:
    • the first paragraph talks about the result
    • the second paragraph talks about left-to-right evaluation and short-circuiting
  4. The second paragraph needlessly says that the result is bool. The first paragraph already states that the result is true or false, so this information is redundant.
  5. The wording contains the phrase "the expression is sequenced" which doesn't make any sense because an expression is a syntactical construct and cannot be sequenced. Only an evaluation can be sequenced.
  6. The paragraphs contain a mixture of first/second terminology and left/right terminology. The PR uses left/right terminology in all places.
  7. Other places in the standard contain notes about "the short-circuiting behavior" of the && operator. However, this is not noted in the description of the && and || operator. This information is added to a note.

@Eisenwave
Copy link
Contributor Author

image

@jensmaurer
Copy link
Member

[intro.execution] defines sequencing of an expression, and that expressly means both value and side effects. Your rewrite is unclear about that. Please revert.

Also, I really would like to retain a statement what value category and what type a logical-and-expression has. In particular, we don't get to the "value" part unless we actually evaluate the expression. Saying the expression is a prvalue of type bool would address this concern.

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

2 participants