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

Brandon Knope bknope at me.com
Wed Jun 22 19:44:35 CDT 2016


Isn't this more caused by confusion about how infinite sequences work?

The prefix one is no longer an infinite sequence. The second one still is. The second one will always infinite loop unless you break

Brandon

Sent from my iPad

> On Jun 22, 2016, at 5:28 PM, Erica Sadun via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On Jun 14, 2016, at 8:16 PM, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> As you will see from earlier messages, the confused user is both quite real and *is* on this list. Nor, mind you, are pedagogical concerns to be trivialized; they are serious concerns for the design of the language. On what grounds do you assert that something is "not confusing at all" when there has been testimony saying "it was confusing to me"?
>> 
>> Some of us on this list interact regularly with novice coders. I draw upon these experiences here. Do you have some special insight you'd like to share in that regard?
>>> On Tue, Jun 14, 2016 at 20:57 Jon Akhtar <jona at herbalife.com> wrote:
>>> How about the goal of it being a delightful language to program in. I think that is getting lost in proposals like these. Optimizing for some mythical new user, who really isn’t present on this list to give an opinion seems like a false argument to make, and your technical sophistication makes you a less qualified than most to say what is and what isn’t confusing to new users because you haven’t been one in a long time.
>>> 
>>> -1 Leve it in. It is perfectly simple as is. Not confusing at all. There are far more confusing aspects to the language than this.
>>> 
>>> Cheers
> 
> Yet another case from a few minutes ago:
> 
> [3:08pm] rullie: hi, could someone walk me through this http://pastie.org/10887040
> [3:08pm] rullie: why is it that for loop through an lazy infinite sequence does not terminate even with the where clause invovled?
> [3:08pm] mikeash: "where" means "skip iterations when this condition is not true"
> [3:08pm] mikeash: it doesn't mean "halt the loop when this is not true"
> [3:08pm] rullie: oh whoa.. ok
> [3:09pm] mikeash: it can't know that you'll never see another value < 100, so it keeps on going
> [3:09pm] rullie: ok, i completely misunderstood the where clause then
> [3:10pm] mikeash: I can see how it might look like it does that
> [3:10pm] rullie: is there a syntax that achieves what i want to do without having to have a if-break in the loop?
> 
> 
> -- E
> p.s. Posted with permission from both participants
> 
> _______________________________________________
> 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/20160622/aea37b24/attachment.html>


More information about the swift-evolution mailing list