[swift-evolution] [Pitch] Retiring `where` from for-in loops

let var go letvargo at gmail.com
Mon Jun 13 12:46:49 CDT 2016


On Mon, Jun 13, 2016 at 8:26 AM Erica Sadun <erica at ericasadun.com> wrote:

>
> > On Jun 13, 2016, at 9:23 AM, let var go via swift-evolution <
> swift-evolution at swift.org> wrote:
> >
> > I am 100% with Charlie on this. Expressiveness has to do with the
> *effectiveness* of conveying a thought or a feeling.
> >
> > Keep "where". It is expressive. It conveys a specific idea effectively
> and concisely.
>
> For those of you in favor of retaining `where`, how do you feel about
> adding `while`, `until`, `unless`, etc?
>
> -- E
>
>
That would be interesting...I assume that 'while' or 'until' would cause
early exit from the loop, and 'unless' would be the logical inverse of
'where'.

I'd have to think about it some more, but my instinct is that I would be in
favor of adding 'unless' as the logical inverse of 'where' (exclude items
based on the predicate, instead of include items based on the predicate). I
wouldn't add 'while' or 'until', because we already have conditional loops
like the 'while' loop to serve that need.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160613/ac905e3c/attachment.html>


More information about the swift-evolution mailing list