You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. Should value be a keyword in a property or indexer get? Should field be a keyword in an indexer?
value is the implicit parameter for set and init accessors. Should that keyword be allowed in get accessors where there is no implicit parameter?
field is the backing field for non-indexer properties. Should that keyword be allowed in indexers where there is no obvious backing field?
In both cases, the only use of the keywords may be nameof().
objectP{get => nameof(value);}objectthis[int i]{
get {return _list[i];}
set { _list[i]=value?? nameof(field);}}
3. Should field and value be considered keywords in lambdas and local functions within property accessors?
It seems obvious that field and value should be allowed in nested functions, to allow closures over those values, but confirming that field and value are keywords in nested functions.
4. Should field and value be keywords in property or accessor signatures?
field and value will be considered keywords within accessor bodies. Should they also be considered keywords outside the accessor bodies in the property and accessor signatures?
Open questions for
field
andvalue
as contextual keywordsOpen questions for
field
andvalue
as contextual keywords. Some of these issues were raised at the previous LDM discussion.1. Allow
nameof(field)
andnameof(value)
?nameof(value)
is useful for error reporting, and has an obvious value of"value"
.Should
nameof(field)
also be supported? If so, what is the expected value ofnameof(field)
?2. Should
value
be a keyword in a property or indexerget
? Shouldfield
be a keyword in an indexer?value
is the implicit parameter forset
andinit
accessors. Should that keyword be allowed inget
accessors where there is no implicit parameter?field
is the backing field for non-indexer properties. Should that keyword be allowed in indexers where there is no obvious backing field?In both cases, the only use of the keywords may be
nameof()
.3. Should
field
andvalue
be considered keywords in lambdas and local functions within property accessors?It seems obvious that
field
andvalue
should be allowed in nested functions, to allow closures over those values, but confirming thatfield
andvalue
are keywords in nested functions.4. Should
field
andvalue
be keywords in property or accessor signatures?field
andvalue
will be considered keywords within accessor bodies. Should they also be considered keywords outside the accessor bodies in the property and accessor signatures?5. Should
nameof(field)
andnameof(value)
be allowed in property and accessor signatures?Related to the previous question, but specifically as values using
nameof()
.The text was updated successfully, but these errors were encountered: