[swift-evolution] [Proposal Draft] Flexible memberwise initialization

Joe Groff jgroff at apple.com
Wed Jan 6 17:08:36 CST 2016


I find it surprising that you key the initialization of 'var's based on whether their setter is visible or not. Initialization is not the same as setting, and memberwise initializers within the definition have private access to the member anyway; this is why `let` properties can be initialized, after all. `private(set)` is also a way for an API to communicate that a property is read-only without promising that it is or will always be immutable, so I think it's important that a 'private(set) var' be as capable as a 'let' to the maximum degree possible.

-Joe


More information about the swift-evolution mailing list