Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Explicitly target latest C# langversion #1318

Closed
WhitWaldo opened this issue Jul 3, 2024 · 2 comments
Closed

[Proposal] Explicitly target latest C# langversion #1318

WhitWaldo opened this issue Jul 3, 2024 · 2 comments

Comments

@WhitWaldo
Copy link
Contributor

WhitWaldo commented Jul 3, 2024

Describe the proposal

I would like to propose that the .NET SDK adopt a policy of explicitly targeting the latest C# language version across all SDKs as opposed to inherently supporting the minimal language introduced with the oldest framework being targeted (currently targeting C# 10 via the support for .NET 6 where the latest is currently on C# 12).

We shouldn't be targeting any of the preview language versions as that would introduce headaches to maintain and introduce reliability concerns, but by supporting the latest languages, we can continue to debate the EOL strategy around older frameworks while still allowing the syntactic sugar of recent releases.

By supporting the most recent language by default, this has at least three noted benefits:

  • It lowers the chance of unintended bugs being introduced because newer language features eliminate the chance of unexpected operations (e.g. by favoring is not null instead of != null, we get the compiler guarantee that won't inadvertently utilize any user-overloads of != or ==).
  • New syntactic sugar usually means more can be expressed in less code, reducing the burden on maintainers to review PRs while improving understandability
  • It lowers the burden for new contributors to add to the SDK as they are more likely to be versed in the latest languages than developing against an older language devoid of what they're used to using
@philliphoff
Copy link
Collaborator

While one can generally use newer versions of C# with older .NET runtime versions, some C# features require a certain .NET minimal runtime version and those cases can be subtle. I might be ok with bumping up the language version for an internal project as it has a much smaller audience, but for an OSS project I'm hesitant to break from Microsoft's stated requirements. What can I say--I've always been a rule follower. :-)

I'd be ok with considering support for .NET 7 deprecated as of (the imminent) 1.14 release. For .NET 6, depending on the timing, we may be able to consider its support deprecated with the 1.15 release. That would mean .NET 8 becoming the minimally supported version thereafter, for which we can then bump up the language version to C# 12.

I'm dying to use all the new snazzy features of C# 12, too, but I think we need to hold on just a bit longer for the Dapr .NET SDK.

@WhitWaldo
Copy link
Contributor Author

That's fair. I didn't think about language-specific dependencies on frameworks.

I think the timing makes sense. The 1.15 release can be tested with the preview bits of .NET 9 (it should probably at least merit a test suite even if it's not officially supported) and be ready for Day 1 support and transition to .NET 8 as the new LTS base with C# 12.

Thanks for chiming in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants