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

Erica Sadun erica at ericasadun.com
Wed Jun 22 16:21:59 CDT 2016


> 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 <mailto: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:

rullie <member:rullie>: hi, could someone walk me through this http://pastie.org/10887040 <http://pastie.org/10887040>
[3:08pm] rullie <member:rullie>: why is it that for loop through an lazy infinite sequence does not terminate even with the where clause invovled?
[
[3:08pm] mikeash <member:mikeash>: "where" means "skip iterations when this condition is not true"
[3:08pm] mikeash <member:mikeash>: it doesn't mean "halt the loop when this is not true"
[3:08pm] rullie <member:rullie>: oh whoa.. ok
[3:09pm] mikeash <member:mikeash>: it can't know that you'll never see another value < 100, so <member:so> it keeps on going
[3:09pm] rullie <member:rullie>: ok, i completely misunderstood the where clause then
[3:10pm] mikeash <member:mikeash>: I can see how it might look like it does that
[3:10pm] rullie <member: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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160622/a013799f/attachment.html>


More information about the swift-evolution mailing list