Syntactic sugar for primary constructors #7718
Unanswered
ghadzhigeorgiev
asked this question in
Language Ideas
Replies: 2 comments 12 replies
-
Why does this need language support? You can already very easily manage DI via constructor, properties or other forms of injection through the supported features of whatever IoC container you are using. |
Beta Was this translation helpful? Give feedback.
1 reply
-
It's cleaner, for example:
One can clearly see what's part of the class, what's inherited and what are the interfaces, and lastly, what class needs to be injected from outside. Now compare to
quickly becomes messy. Behind the scenes, compiler will generate same code and also, if one prefers the other ways, they still be there. |
Beta Was this translation helpful? Give feedback.
11 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Will be nice to allow something like
or
It will be just a syntactic sugar but will be easy on the eye and will reflect better the intention.
This should not prevent one from using also
or old way
which will keep existing code compatible.
Beta Was this translation helpful? Give feedback.
All reactions