[swift-evolution] [Review] SE-0123: Disallow coercion to optionals in operator arguments
david.ronnqvist at gmail.com
Tue Jul 19 13:03:58 CDT 2016
> * What is your evaluation of the proposal?
-1. I agree that there is a problem with optional coercion for the ?? operator (and have on occasion encountered the type of bugs/mistakes that the proposal mentions). However, I'm against the proposed solution to that a problem.
Some operators (like +) already have a way of not allowing coercion to optionals. For other operators (including custom operators) allowing coercion to optionals can still be useful (for the same arguments as it is useful for functions).
I feel that a more appropriate solution to this problem is to disallow coercion to optionals for only the ?? operator (similar to SE-0121 or the various comparison operators).
Since this proposal wants to change the behavior of all operators it would nice be if it included a list of other operators, pointing out which ones already don't permit optional coercion, for which ones optional coercion is problematic, and for which ones it is convenient.
> * Is the problem being addressed significant enough to warrant a change to Swift?
If SE-0121 is accepted, then the optional coercion for the comparison operators will already be dealt with.
I feel that the ?? operator is problematic enough to warrant a change, but am not convinced that the same is true for operators in general.
> * Does this proposal fit well with the feel and direction of Swift?
> * If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
> * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
Read the proposal and experimented with optional coercion for some other operators in a playground.
More information about the swift-evolution