[swift-evolution] [Proposal Draft] Flexible memberwise initialization
matthew at anandabits.com
Mon Dec 21 14:38:37 CST 2015
Sent from my iPhone
> On Dec 21, 2015, at 2:21 PM, Tino Heth <2th at gmx.de> wrote:
> I already encountered a downside of the memberwise initializer - but that's already addressed (at least partly) as point 4) in Chris' list:
> Let's say I have a struct with 10 members, and all of them have a default; the current initializer doesn't use the defaults, so you have the burden of filling all parameters on your own, even if you only want to customize a single parameter.
> It would be nice to see that resolved, but imho the proposal looks quite long and complicated (but it's late here in Europe ;-)
The design of the feature is intended to be simple and intuitive so that it just "does the right thing". Its *use* is not intended to be complicated at all.
The case you mention of propagating initial values to default parameter values is one of the many use cases it covers.
I agree that the proposal is pretty long. The proposed feature interacts with many other language features including access control, inheritance, property behaviors, etc. All of the interactions need to be addressed.
I would be happy to discuss how the feature as proposed would behave in any specific use cases if you have questions about them.
More information about the swift-evolution