meetings/2019/LDM-2019-01-09.md
Discussed over email as well.
Proposal: bind e.GetAsyncEnumerator() and use the result, including methods
with optional parameters or params and extension methods.
We like the simple bind accepting optional parameters and params, but
extension methods are a problem. We have a number of different features that
have backwards compatibility constraints preventing them from preferring extension
methods over interface implementation. In addition, the design of extension methods
is always as a last resort and we prefer code directly from the type (including
interface implementation).
Conclusion
Bind a lookup, but without extension methods. After looking for the interface,
consider extension methods. Follow-up issue to deal with the difference with
simple foreach, which always looks for a zero-parameter method and doesn't
consider extension methods.
Q: What about [Caller...] attributes?
A: Let's do what we did for LINQ, which has to do roughly the same thing.
Do we respect the obsolete attribute in lookups in foreach, async foreach, and pattern dispose?
Conclusion
Yes.
Example:
if (o is string[][]?(var e0, var e1, var e2) s)
This is now ambiguous because the token after the ? is not helpful in
resolving the ambiguity.
Array<int[]?>
new Array<int[]?>(3)
new Array<int[]?> { new[] {1}, null, new [] {2, 3 }}
Conclusion
Let's try (2) and see how it works.
Yes, we think so.
Yes. The extra developer work required is worth it.
e switch {
1 => true,
2 => false,
}
Yes, permit optional commas anywhere there are curly braces, including switch expressions, property patterns, etc.
Scenarios that result in unnecessary warnings:
Options:
thisConclusion
Let's keep option 0 for now. We're worried about silently hiding legitimate warnings or that options 4 and 5 are too complicated or expensive to implement.