> On 9 Jun 2016, at 09:47, Brent Royal-Gordon <[email protected]> wrote:
>
>> Can we get some clarification as to why ‘where’ is being chosen to be
>> retired here? I’m deeply disappointed by that decision as enabling the
>> consistent use of comma as a separator does not preclude the use of where
>> for simple cases that don’t require it. I’m all for having a more usable
>> separator for complex conditionals, but I rarely need it, meanwhile in
>> common, simple conditional bindings and patterns I find the ‘where’ keyword
>> a lot more readable, i.e:
>>
>> if let value = foo where foo > 5 { … }
>
> if case .cartesian(let x, let y) where x != y = point { ... }
> if let value where value > 5 = foo { ... }
Sorry about the immediate followup, but I just recalled you mentioned multiple
conditional binding, which would have brackets, so what about the following:
if case .cartesian(let x, let y where x != y) = point { … }
if let (value where value > 5) = foo { … }
if let (foo, bar where foo > 5) = (maybeFoo, maybeBar) { … }
While it requires brackets for the single conditional binding (you could still
drop them with no where clause though) it seems easier to read to me. For
consistency this would probably apply to your for loop suggestion like:
for (eachValue where eachValue > 5) in theValues { … }_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution