> On 1 May 2016, at 09:12, Антон Жилин <antonyzhi...@gmail.com> wrote:
>
> Pattern binding for optionals will look like:
>
> if let x? = y { … }
Would take a little getting used to, but I think I’d be fine with it, as the
way things are now is inconsistent with regular assignments (which remain
optional).
My only concern is why the question mark on the left hand side? I don’t really
have any concrete reason against it, but it just feels kind of odd to me, I’m
just hoping for some reasoning why some of the alternatives aren’t better fits
like:
if let x = y? { … } // More like optional chaining, which is familiar
as an “if non-nil proceed” behaviour
if let x ?= y { … } // More obviously a special type of assignment that
could fail if y is nil
Again, I’m in favour, I’m just curious why the mentioned format, were others
considered previously, or is just because that’s how the case-keyword form does
it? (I don’t use it as I’ve never liked that form, and it doesn’t seem that
well known anyway).
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution