Skip to content

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

Merged

Conversation

MathiasVP
Copy link
Contributor

#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.

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.
Copy link
Contributor

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).

Copy link
Contributor Author

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.

Copy link
Contributor

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 Assignments and Initializers as the name indicates otherwise?..

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'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?

geoffw0
geoffw0 previously approved these changes Aug 19, 2021
Copy link
Contributor

@geoffw0 geoffw0 left a 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)

@MathiasVP
Copy link
Contributor Author

(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.

Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

👍

@geoffw0
Copy link
Contributor

geoffw0 commented Aug 23, 2021

Merging.

@geoffw0 geoffw0 merged commit bc99947 into github:main Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants