Skip to content

Variables and Variable References #324

@RexJaeschke

Description

@RexJaeschke

This Issue replaces Issue #270, ‘Revising the Definition of “Variable Reference”.’

I’ve put each proposal in a separate Comment, so you can record a thumb-up/down for each.

Defining two kinds of variable references

The key to my proposals below is to have two flavors of variable reference: modifiable and non-modifiable, so we can adequately spec the following V7 features:

  • Input parameters
  • Methods/delegates with ref returns
  • local ref variables
  • Conditional expressions having a ref result
  • ref assignment

Variable reference

10.5 Variable references says

A variable_reference is an expression that is classified as a variable. A variable_reference denotes a storage location that can be accessed both to fetch the current value and to store a new value.

variable_reference
    : expression
    ;

Note: In C and C++, a variable_reference is known as an lvalue. end note

Proposal 1: We should use the term “variable reference” (rather than “variable”) in all contexts involving an expression that denotes a variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: clarityWhile not technically incorrect, the Standard is potentially confusing

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions