Follow up on #1608 (comment)
During the April 08 committee meeting, we merged #1608 and agreed to this follow up issue.
This new text has issues:
The simple_assignment and compound_assignment expressions assign a new value to a variable, a property, or an indexer element. Event assignment (§12.23.5), a subset of compound_assignment, assigns a new value to an event. The ref_assignment expression assigns a variable reference (§9.5) to a reference variable (§9.7). The deconstructing_assignment assigns values to zero or more variable_references.
We think we should separate discards from variable_references in text. That would enable us to use the number of LHS arguments more clearly. Here's why:
- A simple_assignment can assign zero variable_references:
_ = M(); The method M must be called to preserve any side-effects, but no variable_references are assigned.
- This isn't a deconstructing assignment: It's a simple assignment with parentheses around the discard:
(_) = thing;
- Ref assignment can assign the ref to a discard:
_ = ref Func();
A bit of wordsmithing is necessary, but it should the following:
- A discard can't be the left argument of a compound_assignment.
- The simple_assignment and ref_assignment assign a single value, as long as the left argument is a variable_reference. In other words, not a discard.
- The deconstructing_assignment assign two or more values, as long as the corresponding element on the left side is a variable_reference, not a discard.
The expression on the right side of a simple_assignment and deconstructing_assignment even when the corresponding target is a discard.
Follow up on #1608 (comment)
During the April 08 committee meeting, we merged #1608 and agreed to this follow up issue.
This new text has issues:
We think we should separate discards from variable_references in text. That would enable us to use the number of LHS arguments more clearly. Here's why:
_ = M();The methodMmust be called to preserve any side-effects, but no variable_references are assigned.(_) = thing;_ = ref Func();A bit of wordsmithing is necessary, but it should the following:
The expression on the right side of a simple_assignment and deconstructing_assignment even when the corresponding target is a discard.