Feature focus in the C# 16 cycle #10276
Replies: 15 comments 25 replies
|
I would also like to see revising two-phase lookup in extensions being added to C# 16 theme as well. Currently not being able to infer the type parameter of the receiver in a generic extension method over a generic type creates a very bad UX and pushes people away from using extensions in such scenarios. There's a separate proposal that tries to use a discard for the type argument, which actually doesn't work well here becuase it prevents type composition and blocks most goodies that generic extensions can provide. This also fit into the "Type inference improvements" category. |
|
Are |
|
I’m going to strongly disagree on the direction going forward here. I don’t think you guys can keep going on pretending the world hasn’t changed- it has. The reality is that the days of writing code by hand are essentially over. And LLMs don’t need features that save a few keystrokes here and there (Dictionary Expressions being a great example). In my opinion, the value-add from the language perspective are areas where the language gets fundamental capabilities it could not do before (like the seemingly shelved extension interfaces), or areas where substantial expressiveness wins could be had. Frankly, I’m not sure any of these proposals qualify other than improved type inference. |
|
I would kindly like to ask about the status of left join in query Syntax. When can we expect this to to be implemented? It has already been approved, but still no signs of impl progress. |
|
Could generic bridging (#6308) be investigated? The runtime feature that would make it possible is currently scheduled to be part of .NET 12. |
|
I've hit walls several times in the past due to lack of partial generic type inference: TEntity FindByKey<TEntity, TKey>(TKey key) where TEntity: Entity<TKey>
{
// ....
}Given: class Product: Entity<Guid>;I would love to be able to do: var product = FindByKey<Product>(someGuid);since the I would love to see stuff like that in C#. |
|
Declarative UI sounds interesting! What about the |
|
it is unfortunate that due to historic reasons, the most desirable behavior for an enum is not going to be 'default' |
|
Inherited ctors please! There are numerous cases where these would be essential. In general, if a subclass does not implement new ctors, the compiler can infer a matching signature from the superclass (or superclass chain). If the subclass implements a different signature, invoking that signature invokes that implementation. Invoking a different signature would trigger the superclass resolution mechanism. |
|
Sorry if this off topic, but is there a issue or plan for C# 16 to add top level extensions? (extension blocks without a parent class to save a tab) |
|
Focus only on (seemingly) low-hanging fruit, whereas #8870 has been stuck in limbo for years now. |
|
#2068 / dotnet/roslyn#45284 is still a pain point for me. Understand this probably doesn't have universal appeal but just wanted to prompt that at least one person (me) still has this on their radar. |
|
All of this is great but is adding unbound or partialy bound generics in type parameter aliases planned? #1239 I see it as something we might want more and more as people use Result<T, TErr>, as they could want to choose the TErr for their namespace globally. |
|
|
Relieved to read that the "declarative UI construction" rather seems to be a set of general language features that also benefits declarative UI construction. |
Uh oh!
There was an error while loading. Please reload this page.
Feature focus in the C# 16 cycle
Here's where I believe we should apply our resources over the next year or so.
Unsafe v2
This is major feature work that is already ongoing. The dependencies up and down the stack are significant, and we should expect to keep tweaking aspects of the feature for a while based on feedback and experience.
That said, most users will only be indirectly affected by the changes to
unsafe. It is going to improve the safety of critical code, but not the coding experience of most developers.Dictionary expressions
Dictionary expressions were intended to go into C# 15 but won't quite make it. We should get it over the finish line.
Closed enums
Closed enums is the last of a trio of features focused on exhaustiveness, with unions and closed hierarchies making into C# 15. This is a smaller feature to ensure enums are only used as intended, and pattern matching code handles all possible values.
Type inference improvements
As we were designing unions, many possible next features were explored. I believe the most fundamental and broadly useful are around type inference: Using it in more contexts, and inferring more from those contexts.
Inference from more context
The target type of an expression, when it has one, could supply useful information about the expected result type. In factory/constructor scenarios in particular, that is often the only place we would be able to infer type arguments from.
In addition, constraints could be used to proactively make the right inference instead of just rejecting a wrong one after the fact.
Finally, for unions to fully benefit, inference should exploit the relationship between a union type and its case types the same way it does inheritance today.
Inference in more places
Generic type inference currently applies only to the use of generic methods. We should use it also for type parameters to generic types, when they are instantiated or pattern-matched against. Unions and closed classes could significantly benefit.
Declarative UI construction
The Windows team is exploring approaches to declarative UI construction in C#, and there are several ways that new language features would likely help. While these likely wouldn't be candidates for the C# 16 time frame, we should devote design resources to participate in this exploration for future benefit.
All reactions