[swift-evolution] Proposal: Replace ?? by an (optional) argument to ?

Thorsten Seitz tseitz42 at icloud.com
Sat Jan 30 10:31:50 CST 2016


> Am 26.01.2016 um 03:30 schrieb Amir Michail via swift-evolution <swift-evolution at swift.org>:
> 
> 
>> On Jan 25, 2016, at 9:28 PM, Erica Sadun <erica at ericasadun.com> wrote:
>> 
>> Not loving this.  I'm quite happy with ??-coalescing and don't see
>> a compelling reason it needs to be "cleaner". I find your suggested
>> enhancement less readable. Looks like an optional chaining across 
>> a function.
>> 
> 
> ?? puts the least important part of the expression in the most important position — namely, the end.


I think that’s actually a very good place as it is the option that is considered last.

-Thorsten


> 
>> -- E
>> 
>>> On Jan 25, 2016, at 7:03 PM, Amir Michail via swift-evolution <swift-evolution at swift.org> wrote:
>>> 
>>> Examples:
>>> 
>>> * instead of x ?? false, you would have x?(false)
>>> * instead of x?.isEmpty ?? false, you would have x?(false).isEmpty
>>> 
>>> I think this change would result in cleaner looking code.
>>> 
>>> 
>>> _______________________________________________
>>> swift-evolution mailing list
>>> swift-evolution at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-evolution
>> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list