[swift-evolution] [Review] SE-0018 Flexible Memberwise Initialization
Brent Royal-Gordon
brent at architechies.com
Wed Jan 6 22:41:44 CST 2016
> * What is your evaluation of the proposal?
I am generally in favor. I enjoy the current memberwise initializer feature and would like to see it become useful in more cases.
One thing I don't like (and was intending to discuss—the review snuck up on me) is the keyword `memberwise`. This is the name of the current feature, but I don't think it's very well-chosen. "Member" refers to all of the things attached to a type: properties, subscripts, methods, initializers, etc. But a "memberwise" initializer only initializes the stored properties, not any of these other things. Perhaps instead of `memberwise`, the keyword should be `property` or `propertywise`.
I'm not precisely sure what would be best, and keyword bikeshedding might be best left for a separate proposal. In any case, this defect is not nearly severe enough to make me want to scuttle the feature.
> * Is the problem being addressed significant enough to warrant a change to Swift?
Yes. The current memberwise initializers are unavailable in any situation with even the slightest complications. I think this proposal vastly improves the feature.
> * Does this proposal fit well with the feel and direction of Swift?
I think it does. It makes something that was previously implicit explicit instead, reducing boilerplate while still providing plenty of flexibility.
> * If you have you used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
I haven't, unless you count highly dynamic languages where you can easily build a constructor that initializes from a dictionary. This proposal is *far* more explicit than that sort of solution, which seems like an improvement to me.
> * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
I've participated in discussions about this feature since before it was formally proposed; I think I may have been the first person to bring up memberwise initializers as a target for improvement on this list. I've dug around in the Swift compiler and took a vague stab at implementing some related features, although I didn't get very far. I think my understanding of this issue is pretty in-depth.
--
Brent Royal-Gordon
Architechies
More information about the swift-evolution
mailing list