[swift-evolution] [DRAFT] Regularizing Where Grammar (was Re: Add a while clause to for loops)

Xiaodi Wu xiaodi.wu at gmail.com
Fri Jun 10 14:32:38 CDT 2016


On Fri, Jun 10, 2016 at 2:08 PM, Erica Sadun <erica at ericasadun.com> wrote:

>
> > On Jun 10, 2016, at 1:06 PM, Rob Norback via swift-evolution <
> swift-evolution at swift.org> wrote:
> >
> > Following Brent's logic that the for-in where should mimic the switch
> statement functionality, then this example:
> >
> > for (eachKey, eachValue)
> > where eachValue > 5
> > in theKeyValuePairs {... }
> >
>
> <squish>
>
> I finally convinced myself of which direction I wanted to go:
> https://github.com/apple/swift-evolution/pull/362/files
>
> Related blog post here:
> http://ericasadun.com/2016/06/10/swift-where-oh-where-can-my-where-clause-be/
>
> Big thanks to Brent and Wux.
>

I'm rather taken by the idea of replacing `where` with `if` for `case` and
`catch`: it's unambiguous and eliminates the implication of a subordinate
semantic relationship which can't actually be enforced, while still
exposing all of the expressiveness made possible by `where` in that
particular scenario.


>
> -- E
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160610/ffb5fa64/attachment.html>


More information about the swift-evolution mailing list