[swift-evolution] [Proposal Draft] Flexible memberwise initialization
tseitz42 at icloud.com
Tue Dec 22 11:22:11 CST 2015
> Am 22.12.2015 um 05:43 schrieb Matthew Johnson via swift-evolution <swift-evolution at swift.org>:
> What do you think the downsides are of synthesizing memberwise initialization for properties with an “initial value”?
When using the memberwise initializer those properties are always assigned a value twice. First the initial value and then the value provided by the initializer. The first value is constructed and assigned unnecessarily and in corner cases this might even be problematical, e.g. if creating a value of a certain kind has a side effect like incrementing an instance counter or logging something.
More information about the swift-evolution