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

[Motion cwg 7] P2915R0 (Proposed resolution for CWG1223) #6329

Merged
merged 2 commits into from Jul 16, 2023

Conversation

burblebee
Copy link
Contributor

@burblebee burblebee commented Jun 21, 2023

Fixes #6282.
Fixes cplusplus/papers#1596

Notes:

  • The wording for this paper is problematic, both for type-id and for declaration (e.g. trying to redefine grammar production rules). I did my best to improve it editorially with the changes you see, and inserted FIXMEs to point out the remaining badness.

@burblebee burblebee marked this pull request as ready for review June 21, 2023 21:32
@@ -1081,7 +1081,8 @@
conversion\iref{expr.type.conv} as its leftmost subexpression can be
indistinguishable from a \grammarterm{declaration} where the first
\grammarterm{declarator} starts with a \tcode{(}. In those cases the
\grammarterm{statement} is a \grammarterm{declaration}.
\grammarterm{statement} is a declaration,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
\grammarterm{statement} is a declaration,
\grammarterm{statement} is a \grammarterm{declaration},

Restore the change by commit 8b1bd98.
That's bogus because \grammarterm is for uses,
not definitions (which happen in a special LaTeX environment).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One cannot say that a grammar production rule is another grammar production rule. Hence, this was an attempt to improve the wording, taking advantage of the fact that "declaration" is loosely used as a term, so it's possible to alter/embellish/clarify it's definition. This change also follows existing precedence.

Copy link
Member

Choose a reason for hiding this comment

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

We have ambiguous grammar, and this sentence says whether you take one or the other choice. Since grammar is presented as non-terminals expanding to other non-terminals, it seems plausible to say "is a declaration" (i.e. is this branch, not the other one).

Copy link
Contributor Author

@burblebee burblebee Jun 29, 2023

Choose a reason for hiding this comment

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

Ok to say "is to be considered a declaration"? That way we're claiming it's a rule rather than saying it is a rule, and we've used that wording elsewhere so it has precedence.

I reverted the change and added "to be considered" in a separate commit. Note that it's in a separate commit so the editor can choose to apply it (or not) at his discretion.

A syntactically ambiguous statement that can syntactically be
a \grammarterm{declaration} with an outermost \grammarterm{declarator}
with a \grammarterm{trailing-return-type}
is a declaration only if it starts with \keyword{auto}.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
is a declaration only if it starts with \keyword{auto}.
is a \grammarterm{declaration} only if it starts with \keyword{auto}.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

... likewise ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed original commit to follow paper (as suggested) and added "to be considered" in a separate commit.

whose outermost \grammarterm{abstract-declarator}
would match the grammar of an \grammarterm{abstract-declarator}
with a \grammarterm{trailing-return-type}
is to be considered a \grammarterm{type-id} only if it starts with \keyword{auto}.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm using https://isocpp.org/files/papers/P2915R0.pdf to review.
It actually says

Suggested change
is to be considered a \grammarterm{type-id} only if it starts with \keyword{auto}.
is a \grammarterm{type-id} only if it starts with \keyword{auto}.

which is more consistent with the other additions.

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 disagree - it makes no sense for something to be a grammarterm. A grammarterm names a production rule, a purely lexical construct - it is its rule. "is to be considered" isn't right either, but at least we're not trying to redefine a rule.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed original commit to follow paper (as suggested) and added "to be considered" in a separate commit.

source/declarations.tex Outdated Show resolved Hide resolved
Editorial notes:
- [dcl.ambig.res] Use "is to be considered a" instead of "is"
  to avoid redefining the grammar production /type-id/.
- [stmt.ambig] Likewise, don't use \grammarterm "declaration"
  in "is a declaration" to avoid redefining /declaration/.
- [stmt.ambig] Reword comment in example for consistency.
@tkoeppe
Copy link
Contributor

tkoeppe commented Jul 16, 2023

The additional editorial change seems useful, but would it be enough to say "is considered a type-id" instead of "is to be considered a type-id"?

@jensmaurer
Copy link
Member

The additional editorial change seems useful, but would it be enough to say "is considered a type-id" instead of "is to be considered a type-id"?

Works for me.

This avoids suggesting that any \grammarterms are being (re)defined.
@tkoeppe tkoeppe merged commit baea8ec into main Jul 16, 2023
4 checks passed
@jensmaurer jensmaurer deleted the motions-2023-06-cwg-7 branch November 12, 2023 21:28
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.

P2915 R0 Proposed resolution to CWG1223 [2023-06 CWG Motion 7] P2915R0 Proposed resolution for CWG1223
4 participants