Alternate Constructor Syntax #3346
Replies: 3 comments
-
Constructor parameters and properties have different naming conventions, and the team had already decided to not try to map properties to constructors based on a case insensitive or other transformation of the names. |
Beta Was this translation helpful? Give feedback.
-
Then this would be a breaking change and therefore never be accepted as a proposal. |
Beta Was this translation helpful? Give feedback.
-
We will not change the meaning of code without staggering benefit. The risk of breaks is just not worth it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I had an idea last night that I wanted to toss out there. This is related to some of the discussion I've seen about records.
Today, I can have a class like this:
There are four main ways that the type may be constructed:
Currently
E
means "Make a new Foo using the default constructor. Then set some properties".What if the meaning of
E
were to be changed to:Find a constructor such that all parameters are satisfied by the { } arguments and any leftover arguments map to publicly settable properties.
Beta Was this translation helpful? Give feedback.
All reactions