[swift-evolution] [swift-evolution-announce] [Review] SE-0105: Removing Where Clauses from For-In Loops

James Campbell james at supmenow.com
Thu Jun 23 11:10:05 CDT 2016

-1 Where provides a nice clarity when distinguishing the clauses from the
optional binding


*James⎥Head of Trolls*

*james at supmenow.com <james at supmenow.com>⎥supmenow.com <http://supmenow.com>*


*Runway East *

*10 Finsbury Square*


* EC2A 1AF *

On 23 June 2016 at 16:59, Shawn Erickson via swift-evolution <
swift-evolution at swift.org> wrote:

> I am -0.5 on removing the where clause. I will note that removing it now -
> given the appearing limited usage - shouldn't cause a large disruption to
> most users. It may allow us time to think more about it and things related
> to it since it can be added back at a later point without breaking swift 3
> users.
> I personally was bitten by misusing where with a for-in, I had the mental
> model that it would abort the loop. To be honest I am not sure why I had
> that mental model given long history with SQL where clause and using where
> heavily in switch case statements (e.g. acts as a filter). I think for some
> uses I had an assumption that the optimizer could prove that the where
> would in fact always filter past a certain loop point and that may have
> screwed up my mental model in the general case.
> If you make such a mistake with where you may never know because from a
> line debugging perspective your loop content never gets executed if the
> where is violated yet you may still be looping (possibly causing
> destructive consumption or a performance issue).
> With that said I do find the syntax fairly clean and helpful when using
> for-in (if not abused by chaining many together). I don't have a better
> name for it, if it stays around I think it should stay named where to align
> with where in other constructs in the language.
> I do think for completeness we should consider adding 'until' for abort
> looping case. We should also consider moving the location of the where (and
> potential until) on the other side of 'in'.
> One negative to this syntax (assuming not abused) is not being able to
> probe things with a line based debugger. Of course many compact constructs
> in the language are that way. ...maybe someday lldb and Xcode could allow
> for statement scoped breakpoints
> -Shawn
> On Wed, Jun 22, 2016 at 9:12 PM Chris Lattner <clattner at apple.com> wrote:
>> Hello Swift community,
>> The review of "SE-0105: Removing Where Clauses from For-In Loops" begins
>> now and runs through June 29. The proposal is available here:
>> https://github.com/apple/swift-evolution/blob/master/proposals/0105-remove-where-from-forin-loops.md
>> Reviews are an important part of the Swift evolution process. All reviews
>> should be sent to the swift-evolution mailing list at
>>         https://lists.swift.org/mailman/listinfo/swift-evolution
>> or, if you would like to keep your feedback private, directly to the
>> review manager.
>> What goes into a review?
>> The goal of the review process is to improve the proposal under review
>> through constructive criticism and contribute to the direction of Swift.
>> When writing your review, here are some questions you might want to answer
>> in your review:
>>         * What is your evaluation of the proposal?
>>         * Is the problem being addressed significant enough to warrant a
>> change to Swift?
>>         * Does this proposal fit well with the feel and direction of
>> Swift?
>>         * If you have used other languages or libraries with a similar
>> feature, how do you feel that this proposal compares to those?
>>         * How much effort did you put into your review? A glance, a quick
>> reading, or an in-depth study?
>> More information about the Swift evolution process is available at
>>         https://github.com/apple/swift-evolution/blob/master/process.md
>> Thank you,
>> -Chris Lattner
>> Review Manager
>> _______________________________________________
>> swift-evolution-announce mailing list
>> swift-evolution-announce at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution-announce
> _______________________________________________
> 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/20160623/74291f13/attachment.html>

More information about the swift-evolution mailing list