Added notes for August 30th and September 1st

This commit is contained in:
Fredric Silberberg 2021-09-02 13:54:17 -07:00
parent 2f9862c8e6
commit dcd6bda4b8
No known key found for this signature in database
GPG key ID: BB6144C8A0CEC8EE
3 changed files with 218 additions and 12 deletions

View file

@ -0,0 +1,111 @@
# C# Language Design Meeting for August 30th, 2021
## Agenda
1. C# 11 Initial Triage
1. [Generic attributes](#generic-attributes)
2. [List patterns](#list-patterns)
3. [Static abstracts in interfaces](#static-abstracts-in-interfaces)
4. [Declarations under `or` patterns](#declarations-under-or-patterns)
5. [Records and initialization](#records-and-initialization)
6. [Discriminated unions](#discriminated-unions)
7. [Params `Span<T>`](#params-spant)
8. [Statements as expressions](#statements-as-expressions)
9. [Expression trees](#expression-trees)
10. [Type system extensions](#type-system-extensions)
## Quote(s) of the Day
- "Any proposals for a prioritization strategy?"
- "I'm not going to run a ranked choice algorithm in real time"
- "By small, I mean large"
- "Even Midori wasn't crazy enough to put ref and out into the type system" "Maybe that's went wrong"
- "If you're using ref fields for something other than performance, come talk to me and we can find you help"
## Discussion
Today, we start our _initial_ triaging passes for C# 11. It's important to note that, while we talked about a number of potential features for
this cycle, it's extremely unlikely we'll be able to get to all of them. These triage sessions are a good way to see what the LDM is currently
thinking about, but please don't try to speculate about what's in or out of C# 11 from them. We don't even know that yet.
### Generic Attributes
https://github.com/dotnet/csharplang/issues/124
We're shipping this in preview in C# 10 because we found a number of late-breaking incompatibilities with other tools. C++/CLI will straight-up
crash if it encounters an assembly with a generic attribute, even if the type with the attribute is entirely unused, and they're not the only
tool with issues. We'll need to work with them and others to make sure the ecosystem won't crash around generic attributes before we can remove
the preview flag.
### List patterns
https://github.com/dotnet/csharplang/issues/3435
We have a syntactic design and semantic design for arrays and indexable types, but we will need to some more work for `IEnumerable` support.
We hope to have an initial preview soon into the C# 11 development cycle to help get user feedback on the design choices we've made so far.
### Static abstracts in interfaces
https://github.com/dotnet/csharplang/issues/4436
We'll need to look through the feedback consumers give us on the initial preview. We already know that CRTP (ie, `INumeric<T> where T : INumeric<T>`)
might be better served with `this` type constraint, and if we do want to have such a constraint we'll want it now so that the generic math
interfaces can use it where appropriate.
### Declarations under `or` patterns
https://github.com/dotnet/csharplang/issues/4018
This is one of our more common pattern complaints. Let's try and get this done.
### Records and initialization
We have a number of topics around both records and initialization:
1. Required properties
2. Final initializers
3. Factories
4. Primary constructors
5. Public init fields
6. Immutable collection initializers
7. Combined object and collection initializers
8. Nested properties in with-exprs
9. Event hookup in object initializers
We'll look at triaging this list in the next meeting.
### Discriminated unions
https://github.com/dotnet/csharplang/issues/113
There is a ton of interest in this, both within the LDM and in the wider community. At the same time, this is a potentially broad topic, broader
than records, and we have not yet done the work to fully explore the space and break things into individual parts that can combine into a bigger
whole like we did with records. We'll need to start that now if we ever want to ship something in this space (and we do).
### Params `Span<T>`
https://github.com/dotnet/csharplang/issues/1757
This was initially going to be part of the improved interpolated strings proposal, but that feature grew and pushed this part out of scope. We'll
need to work together with the runtime on this to make sure that we're stackalloc'ing where possible but not unnecessarily blowing out stacks. It
might also call for being able to stackalloc an array of reference types.
### Statements as expressions
https://github.com/dotnet/csharplang/issues/3086
We see potential for smaller features here that we can ship one at a time, leaving design priority for other features.
### Expression trees
https://github.com/dotnet/csharplang/discussions/4727
Historically, our inability to improve this space has been because of concern about breaking our customers. However, recent discussions between
EF and members of the LDT have us encouraged, and we plan to look at this.
### Type system extensions
There are a number of type system improvements we could look at, from large changes like roles and extension everything to smaller things such as
unifying our story around `Task` and `Task<T>`/`Action` and `Func`/etc. This last thing would require some kind of unit-type, and `void` is the
obvious choice as it's already the return type of nothing-returning methods. Maybe we could work with the BCL to unify these types and make them
transparent? We could also look at generic improvements around other restricted types, such as pointers and ref structs.

View file

@ -0,0 +1,85 @@
# C# Language Design Meeting for September 1st, 2021
## Agenda
1. [Lambda expression conversions to `Delegate`](#lambda-expression-conversions-to-delegate)
2. [C# 11 Initialization Triage](#c-11-initialization-triage)
1. [Required properties](#required-properties)
2. [Primary constructors](#primary-constructors)
3. [Immutable collection initializers](#immutable-collection-initializers)
## Quote(s) of the Day
- Starting the meeting with 11 minutes of technical issues
- "In my next language, no users"
- "Has anyone made that companion book? Javascript, The Terrible Bits"
- "Do we actually want to do this feature because customers are asking for it, or do we just think it's interesting as an LDM?"
## Discussion
### Lambda expression conversions to `Delegate`
https://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](LDM-2021-08-23.md#better-function-member-now-ambiguous-in-some-cases). 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.
#### Conclusion
We'll keep the conversion rules as they are.
### C# 11 Initialization Triage
Continuing from [last meeting](LDM-2021-08-30.md), 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:
1. Required properties
2. Final initializers
3. Factories
4. Primary constructors
5. Public init fields
6. Immutable collection initializers
7. Combined object and collection initializers
8. Nested properties in with-exprs
9. Event hookup in object initializers
Of these, we can subdivide them into a few sets of categories:
* Truly new features that enable a new type of expressiveness that doesn't exist today. This is 1, 2, 3, and 6.
* Features that build off of others, either in this list or already in the language. This is 4 and 5.
* Features that solve pain points in existing features. This is 7, 8, and 9.
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.
#### Required properties
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.
#### Primary constructors
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.
#### Immutable collection initializers
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.

View file

@ -31,22 +31,32 @@ All schedule items must have a public issue or checked in proposal that can be l
- Generic math and static abstracts feedback (Tanner): https://devblogs.microsoft.com/dotnet/preview-features-in-net-6-generic-math/
## Sep 1, 2021
- Continue initial triage for C# 11 (Mads)
## Aug 30, 2021
- Initial triage for C# 11 (Mads)
- Triage championed proposals without a milestone: https://github.com/dotnet/csharplang/issues?q=is%3Aopen+is%3Aissue+label%3A%22Proposal+champion%22+no%3Amilestone
- Select an initial set of C# 11 timeframe focus features from **Working Set** milestone: https://github.com/dotnet/csharplang/issues?q=is%3Aopen+is%3Aissue+milestone%3A%22Working+Set%22
- Consider promotions from the **Backlog** milestone: https://github.com/dotnet/csharplang/issues?page=1&q=is%3Aopen+is%3Aissue+milestone%3ABacklog
# C# Language Design Notes for 2021
Overview of meetings and agendas for 2021
## Sep 1, 2021
1. Lambda expression conversions to `Delegate`
2. C# 11 Initialization Triage
1. Required properties
2. Primary constructors
3. Immutable collection initializers
## Aug 30, 2021
1. C# 11 Initial Triage
1. Generic attributes
2. List patterns
3. Static abstracts in interfaces
4. Declarations under `or` patterns
5. Records and initialization
6. Discriminated unions
7. Params `Span<T>`
8. Statements as expressions
9. Expression trees
10. Type system extensions
## Aug 25, 2021
[C# Language Design Notes for August 25th, 2021](https://github.com/dotnet/csharplang/blob/main/meetings/2021/LDM-2021-08-25.md)