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

Xiaodi Wu xiaodi.wu at gmail.com
Mon Jun 13 11:10:24 CDT 2016


Actually, at least where I'm from, it wouldn't be a comma, it'd be a bar: ∀
x ∈ X | x > 0.

Moreover, as has been pointed out, the use of 'where' in math is also not
universally loved.

On Mon, Jun 13, 2016 at 11:03 Charlie Monroe <charlie at charliemonroe.net>
wrote:

> `while`, `until` and `unless` all implicate that the loop should break
> when the condition (or its negation) is met.
>
> On the other hand, `where` as it is seems logical to me. Anyone who
> considers serious coding is likely to have basic knowledge of mathematics,
> so something such as
>
> ∀x ∈ X, x > 0
>
> which translates into
>
> for x in X where x > 0
>
> in Swift, which is pretty much how you'd read the mathematical statement.
> Yes, there is a comma, not `where` in the formula but when reading, you say
> "where" (unless you say "every x greater than zero").
>
> > On Jun 13, 2016, at 5:26 PM, 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
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160613/6bc5646a/attachment-0001.html>


More information about the swift-evolution mailing list