Skip to content

Proposal: Declaration Expressions #254

@gafter

Description

@gafter

One feature considered and ultimately not added to C# 6 was declaration expressions. A declaration expression is a new expression of the form

expression:
     local-variable-type local-variable-declarator

Such an expression resolves to an lvalue for a fresh local variable that is definitely assigned only if the declarator contains an initializer. In addition, we would support fresh variables for out arguments:

argument-value:
     out local-variable-type identifier

We need to precisely define the scope of these variables, and perhaps require that they be initialized at the point of declaration.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions