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

[basic.def.odr] Adds note that x may be part of a qualified id #1996

Closed
wants to merge 1 commit into from

Conversation

ryanhaining
Copy link

Following from https://stackoverflow.com/questions/47952024
I'm sure there's a better way to word this.

@jensmaurer
Copy link
Member

Please add the section label to the start of your commit message. Please squash your commits.

source/basic.tex Outdated
@@ -355,7 +355,8 @@
\end{itemize}

\pnum
A variable \tcode{x} whose name appears as a
A variable \tcode{x} whose name appears, possibly as part of a
\grammarterm{qualified-id}, as a
potentially-evaluated expression \tcode{ex} is \defn{odr-used} by \tcode{ex} unless
Copy link
Member

Choose a reason for hiding this comment

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

Would this read better if it said "A variable x whose name appears as a potentially-evaluated expression ex (possibly as part of a qualified-id), is odr-used by ex unless..."?

In general, I'm not convinced this change is a net improvement to start with. In the immediately preceding paragraph, we talk about a "function named by an expression", and qualified-ids are also included there, but not explicitly called out. Calling out qualified-ids in one place, but not another, makes the appearance of a difference where there is none.

Copy link
Author

Choose a reason for hiding this comment

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

If you have a static variable referenced by Widget::x, is that covered by the term name? A "function named by an expression" imo carries a better implication of optionally being qualified.

I don't expect this pr's proposed wording to be accepted.

Copy link
Member

Choose a reason for hiding this comment

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

How about this:

A variable x that is named by a potentially-evaluated expression ex ([expr.prim.id]) is odr-used [...]

This "whose name appears" wording is problematically vague. For example:

int a;
void f(int a) { a = 0 }; // odr-uses ::a?

Copy link
Member

Choose a reason for hiding this comment

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

I like @zygoloid's suggestion.

Copy link
Author

Choose a reason for hiding this comment

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

done

@ryanhaining ryanhaining changed the title Adds note that x may be part of a qualified id [basic.def.odr] Adds note that x may be part of a qualified id Mar 28, 2018
@ryanhaining ryanhaining force-pushed the master branch 2 times, most recently from 384f958 to 53137df Compare April 3, 2018 01:44
@burblebee burblebee force-pushed the master branch 2 times, most recently from bac9908 to 18c6909 Compare April 3, 2018 09:07
source/basic.tex Outdated
A variable \tcode{x} whose name appears as a
potentially-evaluated expression \tcode{ex} is \defn{odr-used} by \tcode{ex} unless
A variable \tcode{x} that is named by a potentially-evaluated expression
\tcode{ex}~(\ref{expr.prim.id}) is \defn{odr-used} by \tcode{ex} unless
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use the \iref macro here instead?

Copy link
Author

Choose a reason for hiding this comment

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

done

@jensmaurer
Copy link
Member

Looks good to me.

@tkoeppe
Copy link
Contributor

tkoeppe commented Apr 6, 2018

I think @zygoloid was still concerned by the potential loss of clarity that it's now no longer clear whether the expression is in its entirety the thing that names x, or whether you could now read it that, say, y<x> "names x".

@zygoloid
Copy link
Member

zygoloid commented May 7, 2018

Hmm, perhaps if we switch from passive to active voice:

A potentially-evaluated id-expression ex that denotes a variable x odr-uses x unless

@jensmaurer jensmaurer added the needs rebase The pull request needs a git rebase to resolve merge conflicts. label May 7, 2018
@tkoeppe tkoeppe removed the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Jun 8, 2018
@zygoloid zygoloid force-pushed the master branch 2 times, most recently from e3dbfe2 to 1a21a65 Compare July 7, 2018 23:19
@zygoloid zygoloid added the changes requested Changes to the wording or approach have been requested and not yet applied. label Oct 8, 2018
@jensmaurer jensmaurer added the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Oct 11, 2018
@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 15, 2019

@ryanhaining Could you please rebase and apply Richard's suggestion?

@ryanhaining
Copy link
Author

Yes, sorry you caught me in the middle of two back-to-back trips so might take me a bit, I'm having a really hard time with hotspots so just doing a pull is taking a while.

@ryanhaining
Copy link
Author

Okay, ready for review.

@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 19, 2021

I think the rewording of https://wg21.link/p1787r6 improved the text sufficiently to resolve the original issue. Please double-check, and feel free to reopen if you would still like to tweak the wording further.

@tkoeppe tkoeppe closed this Jun 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes requested Changes to the wording or approach have been requested and not yet applied. needs rebase The pull request needs a git rebase to resolve merge conflicts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants