On Fri, Jan 29, 2016 at 1:48 PM, Amir Michail via swift-evolution < swift-evolution@swift.org> wrote:
On Jan 29, 2016, at 8:42 AM, Craig Cruden <ccruden@novafore.com> wrote:
still much worse.
What about: Bool(x?.isEmpty) // nil and false => false
On 2016-01-29, at 20:41:06, Amir Michail via swift-evolution < > swift-evolution@swift.org> wrote:
On Jan 29, 2016, at 5:03 AM, Thorsten Seitz <tseitz42@icloud.com> wrote:
I agree with Erica. The ?? operator is very readable IMO.
Furthermore x?(false).isEmpty looks like it would evaluate false.isEmpty
when x is nil which is certainly not what is intended.
What about this then: ??(false, x?.isEmpty)
In addition it would not be clear which default should be used in case of
multiple optional chainings happening, i.e. what should be the result of
person?(false).address?.(true).isEmpty
-Thorsten
Am 26. Januar 2016 um 03:29 schrieb Erica Sadun via swift-evolution < > swift-evolution@swift.org>:
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.
-- E
On Jan 25, 2016, at 7:03 PM, Amir Michail via swift-evolution < > swift-evolution@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@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution