[swift-evolution] [Review] SE-0123: Disallow coercion to optionals in operator arguments
rjmccall at apple.com
Wed Jul 13 12:16:31 CDT 2016
> On Jul 13, 2016, at 10:06 AM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
> -1. This feels like a band-aid rather than a well-considered fix to the issues raised in the proposal. I don't see what makes operators as a class of functions more or less susceptible to these surprising optional upcasts. Removing the comparison operators for optionals will resolve the issue with '<', and if we're concerned about '??', an unavailable overload for ??(T, T) could address that specific issue. Optional promotion in operators is clearly useful in many cases, as the proposal itself concedes by special-case exempting the assignment operator from the restriction and proposing the addition of more than a dozen overloads to restore the equivalent of explicit promotion behavior for specific operators, and that doing so accepts other undesirable formulations like 'nonOptional == nil'. This proposal doesn't make a compelling case that being an operator is the correct criterion to disable optional promotion.
Agreed. To me, the right solution is some attribute to suppress promotion for specific arguments.
When we get to decl-based overload resolution, this will become straightforward to implement.
>> On Jul 12, 2016, at 10:25 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
>> Hello Swift community,
>> The review of "SE-0123: Disallow coercion to optionals in operator arguments" begins now and runs through July 19. The proposal is available here:
>> Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at
>> or, if you would like to keep your feedback private, directly to the review manager.
>> What goes into a review?
>> The goal of the review process is to improve the proposal under review through constructive criticism and contribute to the direction of Swift. When writing your review, here are some questions you might want to answer in your review:
>> * What is your evaluation of the proposal?
>> * Is the problem being addressed significant enough to warrant a change to Swift?
>> * 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?
>> More information about the Swift evolution process is available at
>> Thank you,
>> -Chris Lattner
>> Review Manager
>> swift-evolution mailing list
>> swift-evolution at swift.org
> swift-evolution mailing list
> swift-evolution at swift.org
More information about the swift-evolution