meetings/2019/LDM-2019-07-10.md
[DoesNotReturn] attributeparam! null-checking featureShould the empty switch expression (expr switch { }) be an error?
Conclusion
We can't really find a reason to disallow this.
The current design for the DoesNotReturnAttribute indicates that the method annotated with it
is unreachable after a call to it for the purpose of flow analysis.
The questions are:
Conclusion
Yes to both questions. If we want to add general-case unreachability later we will do it through a different mechanism. That would require altered code generation (to ensure both verifiability and that the code after is truly unreachable) and is out of scope for the current feature set.
param!We previously discussed the param! feature, which is meant to insert a throw
if the parameter is null.
We'd like to confirm some of the details.
Illegal placement:
We think there should be diagnostics for the follow constructs:
void M(string p! = null))! on the property setterSemantics:
notnull constraintthrow?
Syntax:
It was previously mentioned that the syntax could be confusing because ! has different meanings
in expressions or parameter names. Do we want to change the syntax?
Here are some syntax options we discussed:
T p!T p!!T! pchecked T pnonnull T pWe can't decide on a syntax right now. There are concerns that some of the
proposed syntaxes are too verbose and remove the purpose of the feature. There's
also a possible follow-on proposal: right now the ! syntax already has meaning
in an expression context, but if we used a different syntax, like !!, we could
also add a "null-checked expression" which does the same thing for expressions
that it does for parameters. These ideas are interesting enough that we think
we should hold the feature for the next C# version and discuss these possibilities
more.
Conclusion
Some revisions to the feature and some open questions. We want the feature in some form and are committed to resolving these questions for the next release.