Code Upgrade Wizard / Upgrade Refactorings #62861
Unanswered
TonyValenti
asked this question in
Ideas
Replies: 1 comment
-
Breaking existing code on language upgrade is an anti-goal for the team. We would prefer that code keep its meaning as much as possible. We only have changed this when we feel that the fallout and time-window for an issue is exceeding short, and thus users will have very little chance of running into issues. Requiring users to run upgrade tools is not something desirable here as it greatly increases the burden and uncertainty for users about if their code will continue to work as they expect it to on any upgrade. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background:
Most apps have a list of supported versions.
.NET has a list of supported versions.
C# does not: Every C# version is supported.
The C# version you can use is tied to your .NET version.
Most apps automatically upgrade old data formats into the app's current format.
C# does not.
TLDR:
The C# team works hard to maintain compatibility with previous versions of C#, however, prospective ideas can be immediately rejected because
that code already has meaning in C# today
. Former design decisions become permanent constraints which inhibit innovation.There is value in being able to deprecate/remove old syntax while still preserving the meaning of existing code.
To do this, an upgrade wizard could trigger when a project's framework or lang version is changed. The upgrade wizard could apply "upgrade" refactorings to the existing project. Upgrade refactorings could both introduce new language features and remove old ones by replacing code with the current equivalent. As an example, an upgrade refactoring could replace variables named
_
with a new name so that_
always meansdiscard
.Beta Was this translation helpful? Give feedback.
All reactions