[Proposal] Simpler constructor syntax: remove the need for type name in constructor #3486
Unanswered
nawfalhasan
asked this question in
Language Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Significance:
Minor. Mostly a cosmetic change but still.
Proposal:
I often find the need for typing the name of the type in constructor redundant and yields to overall a poor developer ergonomics.
Currently:
Proposal: this should be valid C#
or even better:
Example from the wild: below is valid TypeScript
Reasoning:
I often copy paste classes to quickly generate similar classes. I have to update class names in two places currently. For people not blessed with best of tooling, its often easier to copy paste classes.
Leads to lesser merge conflicts
From a language design stand point, the class name is redundant there. Its saner to not make developer type something that adds no information. Modern languages like TS, Kotlin etc have taken this approach.
Cons:
Beta Was this translation helpful? Give feedback.
All reactions