[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:56:16 CDT 2016


On Fri, Jun 10, 2016 at 2:42 PM, Christopher Kornher <ckornher at me.com>
wrote:

> -1
>
> An alternative would be to:
>
> 1) State clearly in all relevant documentation that ‘where’ filters and
>  ‘while’ terminates.
> 2) Eliminate the use of ‘where’ within ‘while’ clauses.
>
> This seems pretty straightforward to me. The principle in  #1 should be
> easy for even beginners to grasp.
>
>
> Using ‘guard’ statements instead of ‘where’ clauses adds a lot of visual
> noise for me.
>

Yes, that is one alternative mentioned in the proposal.

> On Jun 10, 2016, at 1:08 PM, Erica Sadun via swift-evolution <
> swift-evolution at swift.org> 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.
>
> -- E
>
>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160610/ac9e5e46/attachment.html>


More information about the swift-evolution mailing list