Skip to content

C# 7.x: Unifying treatment of discards and local variables in patterns, deconstruction and out variables #561

@MadsTorgersen

Description

@MadsTorgersen

Pattern, deconstruction expressions and out variables all allow for local variables to be declared in places that are not accounted for by existing scope rules. In addition, those locations allow for the use of discards in lieu of existing or fresh variables.

Currently the treatment of these variables is spread out and partially duplicated across #61, #63 and #44. I think there's both an opportunity and a need for unifying this treatment, quite possibly introducing new concepts/terms in the process.

Perhaps the best approach is to treat this as a separate "feature" with its own PR, which the above PRs can then build on. The "feature" introduces new concepts (e.g. discards), scope rules etc. but does not in and of itself surface them in syntax.

Metadata

Metadata

Labels

status: in-progressThe assignee has actively started working on this; consult with them before taking other actionstype: featureThis issue describes a new feature

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions