meetings/2021/LDM-2021-09-01.md
Delegatehttps://github.com/dotnet/csharplang/issues/5124
Today, we do not allow lambdas without a natural type to be convertible to Delegate or Expression. This can lead to niche but possible
cases where adding type information to a lambda actually makes a method call ambiguous, where the typeless lambda was unambiguous. These
cases, however, are both niche and usually fixable by adding a new, most-specific overload, as we discussed in the notes
last week. Making a change here would also break APIs where the
user has an instance method that takes a Delegate (often not defined in their code) and adds extension methods with strongly-typed delegates
to add the necessary information for the compiler to bind their lambdas. This is a fairly common pattern when working with a Delegate API,
and despite making the language more complex and having weird consequences for niche cases, we think that keeping the existing rule as it is
the appropriate compromise to keep existing code working. While we don't think that we would have this complex of a rule if we were redesigning
the language, we also think that we've hit the limit of breaking changes we'd want to take in this feature.
We'll keep the conversion rules as they are.
Continuing from last meeting, we're triaging potential C# 11 features, this time specifically around initialization and records. The same disclaimer from last time applies: this is early triage. Please do not try to infer what will be in C# 11 or not from these notes. If we don't know the answer to that, these notes won't help you find it either 🙂.
The general list of initialization and record related topics is as follows:
Of these, we can subdivide them into a few sets of categories:
Of these, there are a few that stand out as being features we're more interested in: required properties, primary constructors, and immutable collection initializers.
https://github.com/dotnet/csharplang/issues/3630
We did a big design push on this a little under a year ago. We should revive the proposal, make the changes we talked about at the end of the last design review, and see what we think about it now.
https://github.com/dotnet/csharplang/issues/2691
We've had a few designs for primary constructors over the years. C# 6 nearly shipped with one design, then we shipped records with a design, and now we need to think about how primary constructors will interact with record/class cross inheritance when we get to that. We really need to come back with a new proposal that looks at the past versions, and that may well be next year.
This is an idea we've been ruminating on as we designed the syntax for list patterns: we've given up on trying to make the correspondence principle work with the existing collection initializer syntax, but we could potentially make the principle work by design a new collection literal syntax, one that will work with immutable types as the current one does not. A smaller group will look at this and make a proposal for the space.