Skip to content

Clarify LHS as discard behavior#1639

Open
BillWagner wants to merge 2 commits intodotnet:draft-v8from
BillWagner:variable-discard-destination
Open

Clarify LHS as discard behavior#1639
BillWagner wants to merge 2 commits intodotnet:draft-v8from
BillWagner:variable-discard-destination

Conversation

@BillWagner
Copy link
Copy Markdown
Member

Fixes #1631

"zero or more variable_references" → "two or more targets" (grammar requires 2+ elements; targets can be variable_references or discards)
Adds: compound_assignment LHS shall not be a discard
Adds: simple_assignment and ref_assignment LHS may be a discard
Adds: RHS is evaluated even when target is a discard, but no value is stored

Fixes dotnet#1631
"zero or more variable_references" → "two or more targets" (grammar requires 2+ elements; targets can be variable_references or discards)
Adds: compound_assignment LHS shall not be a discard
Adds: simple_assignment and ref_assignment LHS may be a discard
Adds: RHS is evaluated even when target is a discard, but no value is stored
@BillWagner BillWagner requested a review from Nigel-Ecma April 16, 2026 18:39
@BillWagner BillWagner added the meeting: discuss This issue should be discussed at the next TC49-TG2 meeting label Apr 16, 2026
Comment thread standard/expressions.md Outdated
Comment thread standard/expressions.md Outdated
Restore the simplified summary paragraph, except for deconstructing assignment requiring 2 or more targets.

Add second paragraph describing discard behavior.

Add normative sentence that the left operand of a compound assignment can't be a discard.
Copy link
Copy Markdown
Contributor

@jskeet jskeet left a comment

Choose a reason for hiding this comment

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

I like this latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meeting: discuss This issue should be discussed at the next TC49-TG2 meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

null literal conversions and implicit reference conversions

3 participants