C# Language Design Notes
Notes for Oct 15, 2014
Two items were discussed.
- nameof operator - revised proposal where it takes an expression argument
- string interpolation - revised proposal where the string starts with $
There were two items on the agenda.
- Flesh out the rules for assignment to readonly autoprops in the constructor
- Consider a feature to prevent people outside your assembly from implementing your interface <no>
The meeting focused on rounding out the design of declaration expressions
- Removing “spill out” from declaration expressions in simple statements <yes, remove>
- Same name declared in subsequent else-if’s <condition decls out of scope in else-branch>
- Add semicolon expressions <not in this version>
- Make variables in declaration expressions readonly <no>
The meeting focused on rounding out the feature set around structs.
- Allowing parameterless constructors in structs <allow, but some unresolved details>
- Definite assignment for imported structs <revert to Dev12 behavior>
- Detailed design of nameof <details settled>
- Design of #pragma warning extensions <allow identifiers>
- Limit the nameof feature? <keep current design>
- Extend params IEnumerable? <keep current design>
- String interpolation <design nailed down>
- protected and internal <feature cut – not worth the confusion>
- Field parameters in primary constructors <feature cut – we want to keep the design space open>
- Property declarations in primary constructors <interesting but not now>
- Typeswitch <Not now – more likely as part of a future more general matching feature>
In this design meeting we looked at some of the most persistent feedback on the language features showcased in the BUILD CTP, and fixed up many of the most glaring issues.
- Indexed members <lukewarm response, feature withdrawn>
- Initializer scope <new scope solves all kinds of problems with initialization>
- Primary constructor bodies <added syntax for a primary constructor body>
- Assignment to getter-only auto-properties from constructors <added>
- Separate accessibility for type and primary constructor <not worthy of new syntax>
- Separate doc comments for field parameters and fields <not worthy of new syntax>
- Left associative vs short circuiting null propagation <short circuiting>
- Design of using static <design adopted>
- Initializers in structs <allow in certain situations>
- Null-propagation and unconstrained generics <keep current design>
We iterated on some of the features currently under implementation
- Capture of primary constructor parameters <only when explicitly asked for with new syntax>
- Grammar around indexed names <details settled>
- Null-propagating operator details <allow indexing, bail with unconstrained generics>
In this meeting we reiterated on the designs of a couple of features based on issues found during implementation or through feedback from MVPs and others.
- Syntactic ambiguities with declaration expressions <a solution adopted>
- Scopes for declaration expressions <more refinement added to rules>
This being the last design meeting of the year, we focused on firming up some of the features that we’d like to see prototyped first, so that developers can get going on implementing them.
- Declaration expressions <reaffirmed scope rules, clarified variable introduction>
- Semicolon operator <reaffirmed enclosing parentheses>
- Lightweight dynamic member access <decided on a syntax>
Next up for implementation are the features for auto-properties and function bodies, both of which go especially well with primary constructors. For the purpose of spec’ing those, we nailed down a few remaining details. We also took another round discussing
member access in the lightweight dynamic scenario.
- Initialized and getter-only auto-properties <details decided>
- Expression-bodied function members <details decided>
- Lightweight dynamic <member access model and syntax discussed>
We looked at a couple of feature ideas that either came up recently or deserved a second hearing.
- Invariant meaning of names <scrap the rule>
- Type testing expression <can’t decide on good syntax>
- Local functions <not enough scenarios>
- nameof operator <yes>