[swift-evolution] Make distinction between ?? -> T and ?? -> T?
radexpl at gmail.com
Mon Mar 7 16:26:38 CST 2016
-1, never seen a real world situation where this would be confusing/problematic.
Having one operator is nice for chaining:
var value = someArray ?? someFallback ?? secondaryFallback ?? 
> On 07 Mar 2016, at 22:29, Sébastien Blondiau via swift-evolution <swift-evolution at swift.org> wrote:
> Currently, there is only one nil coalescing operator, which may return an optional value or not, depending on the second parameter. This variability can leads to unclear line of code:
> var isItOptionalOrNot = value ?? otherValue
> I think there should be two distinct operators:
> var certainlyOptional = value ?? otherValue
> var certainlyNotOptional = value ?! notOptionalValue
> In my point of view, this differentiation brings more clarity about wether the result is an optional or not.
> What's your opinion?
> Sébastien Blondiau
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution