Re: [swift-evolution] Change 'for in' expression to for [] { (item) in ... }

2017-07-29 Thread Daryle Walker via swift-evolution
> On Jul 28, 2017, at 12:19 PM, Kwanghoon Choi via swift-evolution > wrote: > > Hello > > I found someone easy mistake using for in loop statement. > > Ex) > var i = 0 > for i in 0..<10 { } > print(i) > > And this user expected print(i) is “10” > > Many experienced swift developers doesn’t

Re: [swift-evolution] Change 'for in' expression to for [] { (item) in ... }

2017-07-28 Thread eyerama via swift-evolution
Thanks for all replies. This is helpful for introduce why for in be that for in other peoples. 나의 iPhone에서 보냄 2017. 7. 29. 05:14 Taylor Swift 작성: > This is funny because this “expected behavior” is actually a heavily > criticized part of C behavior. I think this change would cause just as muc

Re: [swift-evolution] Change 'for in' expression to for [] { (item) in ... }

2017-07-28 Thread Taylor Swift via swift-evolution
This is funny because this “expected behavior” is actually a heavily criticized part of C behavior. I think this change would cause just as much if not more confusion than it alleviates. On Fri, Jul 28, 2017 at 12:19 PM, Kwanghoon Choi via swift-evolution < swift-evolution@swift.org> wrote: > Hel

Re: [swift-evolution] Change 'for in' expression to for [] { (item) in ... }

2017-07-28 Thread Haravikk via swift-evolution
> On 28 Jul 2017, at 17:19, Kwanghoon Choi via swift-evolution > wrote: > > Hello > > I found someone easy mistake using for in loop statement. > > Ex) > var i = 0 > for i in 0..<10 { } > print(i) > > And this user expected print(i) is “10” > > Many experienced swift developers doesn’t misu

Re: [swift-evolution] Change 'for in' expression to for [] { (item) in ... }

2017-07-28 Thread Robert Bennett via swift-evolution
I simply can’t see changing the syntax of such a fundamental construct, especially when a suitable replacement, which accomplishes your desired goal of introducing no new variables outside (visually) of a pair of curly braces, already exists. The language’s development is well past the stage of

Re: [swift-evolution] Change 'for in' expression to for [] { (item) in ... }

2017-07-28 Thread Kwanghoon Choi via swift-evolution
yes, swift already has forEach, but from my point of view, there is an uncomfortable part, like '(0..<10).forEach{}'. like Range type to need wrap it in parentheses for using forEach. my suggestion is not replacing 'for in [] {}' to 'for [] {}'. Can not we have both? Of course, by erasing one befo

Re: [swift-evolution] Change 'for in' expression to for [] { (item) in ... }

2017-07-28 Thread Robert Bennett via swift-evolution
Isn’t this exactly like forEach, which is already in the language? > On Jul 28, 2017, at 12:32 PM, Jacob Williams via swift-evolution > wrote: > > This change would also make it so that for loops follow the same format as > all other closures with variables. > > The downside is that this woul

Re: [swift-evolution] Change 'for in' expression to for [] { (item) in ... }

2017-07-28 Thread Jacob Williams via swift-evolution
This change would also make it so that for loops follow the same format as all other closures with variables. The downside is that this would break a TON of code. I don’t think that the amount of code this breaks would be worth the consistency. And as Alex mentioned, it is possible through .for

Re: [swift-evolution] Change 'for in' expression to for [] { (item) in ... }

2017-07-28 Thread Alex Blewitt via swift-evolution
> On 28 Jul 2017, at 17:19, Kwanghoon Choi via swift-evolution > wrote: > > Hello > > I found someone easy mistake using for in loop statement. > > Ex) > var i = 0 > for i in 0..<10 { } > print(i) > > And this user expected print(i) is “10” The variable shadows any reference in the loop; and

[swift-evolution] Change 'for in' expression to for [] { (item) in ... }

2017-07-28 Thread Kwanghoon Choi via swift-evolution
Hello I found someone easy mistake using for in loop statement. Ex) var i = 0 for i in 0..<10 { } print(i) And this user expected print(i) is “10” Many experienced swift developers doesn’t misunderstand like this. But always someone is new comers, and I think this expression make misunderstand