C# Design Notes for Oct 18, 2016 #16482
Labels
Area-Language Design
Design Notes
Feature - Local Functions
Local Functions
Feature - Pattern Matching
Pattern Matching
Feature - Throw Expression
Throw Expression
Feature - Tuples
Tuples
Language-C#
Language-VB
C# Language Design Meeting Notes, Oct 18, 2016
Agenda
Go over C# 7.0 features one last (?) time to make sure we feel good about them and address remaining language-level concerns.
new
expressionsPattern matching
Wildcards
If we want to reopen the discussion of using
_
, and it doesn't make C# 7.0, we may find ourselves wanting to block off use of_
as an ordinary identifier in the new declaration contexts (patterns, deconstruction, out vars). Let's front load the final design of wildcards to decide if anything needs to happen here.Design "room" between tuples and pattern matching
case (int, int) x:
is not currently allowed, in order to leave design space. More specifically we want this to mean a recursive pattern, rather than just a tuple type, once we get to recursive patterns. We're good with leaving this an error in the meantime, even though it may occasionally be puzzling to developers.Local functions
We want to ideally allow any expression or set of statements to be lifted out in a local method. There are two ways in which this cannot be realized:
Digit separators
We don't allow leading or trailing underbars - they have to be between digits: they are digit separators after all! We think this is fine, but if we hear feedback to the contrary we can try to relax it later.
Throw expressions
They are allowed as expression bodies, as the second operand of
??
, and as the second and third operand of?:
. They are not allowed in&&
and||
, and cannot be parenthesized. We think this is a fine place to land.Tuples
Name mismatch warnings
We don't currently warn about names moving to a different position. Should we?
Ideally yes. There are a lot of weird cases that would be hard to track down, though. Let's get the obvious ones. Essentially where we do implicit conversions we would check and warn.
Use of tuples in
new
You cannot
new
up a tuple type. However, we should certainly allow arrays of tuples to be created. It is probably also fine to keep allowingnew
ing of nullable tuple types:The text was updated successfully, but these errors were encountered: