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

[swift-evolution] Recent change makes Swift 4 less safe.

2017-07-28 Thread Amir Michail via swift-evolution
The latest beta doesn’t allow you to append “()” to an enum name with no associated value in a switch case. This makes Swift less safe because appending that “()” is an excellent way to indicate that you are not ignoring the associated value in the swift case because there isn’t any. Suppose

Re: [swift-evolution] Fast String Comparison From String Arrays

2017-07-28 Thread Huon Wilson via swift-evolution
> On Jul 28, 2017, at 05:54, Omar Charif via swift-evolution > wrote: > > Hi, > > I wonder whether there is already a way in Swift to compare a string against > a large string array quickly without using the traditional ways of > comparison. > > Say we have

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

Re: [swift-evolution] Fast String Comparison From String Arrays

2017-07-28 Thread Michael Ilseman via swift-evolution
This sounds like an interesting idea. The best way to promote this would be to make a Swift package first, so that Swift users can use it right away and we can see how it works in practice. If it has sufficient merit and general applicability, then it makes sense to propose including it in the

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

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

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

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

[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

Re: [swift-evolution] Fast String Comparison From String Arrays

2017-07-28 Thread Alex Blewitt via swift-evolution
If you're doing something like that, you probably want to end up with some kind of bloom filter. Alex > On 28 Jul 2017, at 13:54, Omar Charif via swift-evolution > wrote: > > Hi, > > I wonder whether there is already a way in Swift to compare a string against > a

[swift-evolution] Fast String Comparison From String Arrays

2017-07-28 Thread Omar Charif via swift-evolution
Hi, I wonder whether there is already a way in Swift to compare a string against a large string array quickly without using the traditional ways of comparison. Say we have ["a", "b", "c", "d"] and we would like to find whether this array contains "a", then we decide to check if we have "b"