[swift-evolution] [swift-evolution-announce] [Review] SE-0024 "Optional Value Setter `??=`"

Stephen Celis stephen.celis at gmail.com
Wed Feb 17 07:44:56 CST 2016


> 	• What is your evaluation of the proposal?

I'm against the adoption of this operator. Echoing previous comments:

- Its use can encourage mutability and optionality where immutability and unwrapped types would be preferred
- Its surface area is smaller than the breadth that it covers—as Joe mentioned earlier, a Dictionary extension may be a better proposed solution

I also believe that inclusion in the standard library is an endorsement, and developers coming from other languages with similar operators will adopt its use in scenarios that would be better addressed with careful consideration of mutability and optionality.

> 	• Is the problem being addressed significant enough to warrant a change to Swift?


No. It could create more problems than it solves.

> 	• Does this proposal fit well with the feel and direction of Swift?


Other than the fact that it fits in with the other operators, no. While Swift makes optionals and mutating state easy to work with, it also prefers immutability (it generates fix-its to change "var" to "let") and non-optional types are still much easier (and safer) to work with.

> 	• If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?


I've used Ruby extensively and it's generally a good fit there given the prevalence of nil and mutating state in the language and how the language is generally written. It makes much less sense for Swift for the reasons I mentioned earlier.

> 	• How much effort did you put into your review? A glance, a quick reading, or an in-depth study?


I participated in the earlier discussions, thought about it at length, and looked over my own code to consider where it would be useful.

Stephen



More information about the swift-evolution mailing list