[swift-evolution] SE-0105: Removing Where Clauses from For-In Loops
Russ Bishop
xenadu at gmail.com
Sun Jun 26 17:47:32 CDT 2016
> On Jun 23, 2016, at 7:14 PM, Erica Sadun via swift-evolution <swift-evolution at swift.org> wrote:
>
>
>> On Jun 23, 2016, at 7:34 PM, William Shipley via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>
>> I’m against removing “where" from “for/in”. I use it in my code and I think it aids readability quite a bit. In the example:
>>
>> for x in theArray where x % 2 == 1 { print (x) }
> I have used odd-even examples a lot when presenting this concept, and inevitably the response
> is "Whoa, that's cool". What I'm missing are more challenging real-world use-cases to justify
> the construct, and an exploration of why the challenging cases would not need debugger
> support at that point.
>
> My concern (and I am happy to be corrected) is that any code that becomes slightly more
> complex loses the beauty and readability and hinders debugging at the same time.
>
> — E
Here are two that are shipping right now.
for (key, tile) in self._cache where tile.tintColor != self.tintColor { }
for innerArray in actualValue where innerArray.contains(expectedElement) { }
Russ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160626/4fe9d304/attachment.html>
More information about the swift-evolution
mailing list