-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: Clarify difference between 'Initializer' and 'Assignment'. #6515
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
C++: Clarify difference between 'Initializer' and 'Assignment'. #6515
Conversation
… the QLDoc for these classes.
Co-authored-by: Matan Merom <1010225+matan7890@users.noreply.github.com>
@@ -136,6 +136,9 @@ class Variable extends Declaration, @variable { | |||
/** | |||
* Gets an assignment expression that assigns to this variable. | |||
* For example: `x=...` or `x+=...`. | |||
* | |||
* This does _not_ include the initialization of the variable. Use | |||
* `Variable.getInitializer()` to get the variable's initializer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could mention Variable.getAnAssignedValue()
here (or if we make a new class like Java has, that).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I've added a mention of Variable.getAnAssignedValue()
in 586c5b9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a clarification in Variable.getAnAssignedValue()
that the returned value includes both Assignment
s and Initializer
s as the name indicates otherwise?..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done this now in 207dcb0. I didn't do it initially because I couldn't find a sentence structure that I was happy with. Do you think it's sufficiently clear now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
(though I can't remember whether _word_
renders as an underline, bold, italic or something else)
It renders as italic. It looks like we write not in other places so I just followed that convention. |
…om the initializer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Merging. |
#6510 mentioned that our distinction between a variable assignment, and a variable initialization isn't obvious to new users. This PR addresses part of this problem by clarifying this distinction in the QLDoc for those classes.
The issue also suggests making a common class that captures both assignments and initializers. I haven't done that yet, but if this is something we want to do I'd be happy to do this as a follow-up to this PR.