News for hackers. Stuff that matters.
Re:Swift is like Kotlin by seanwilson on Thursday May 18, 2017 @12:11AM (#14364748)
It confused me as well. "0.. is less than count"?
Re:Swift is like Kotlin by Watabou on Thursday May 18, 2017 @12:18AM (#14364773)
Personally, I find that just having "0..count" requires a bit of thinking on my part trying to decide if it's inclusive or not.

"0..<count" instantly tells me that it's not including value, and follows the matematical interval notification [0..count] vs [0..count)

Re:Swift is like Kotlin by seanwilson on Thursday May 18, 2017 @02:16AM (#14365172)
I'd prefer 0..count or 0..(count - 1) then.
Re:Swift is like Kotlin by proyb2 on Thursday May 18, 2017 @12:54AM (#14364895)
I believe it was discussed in Swift Evolution, not confusing.

    0...1 //0 to 1
Note: triple dot.

    0..2 //error: repl.swift:1:2: error: use of unresolved operator '..'


    0..<1 //0 to <1
Re:Swift is like Kotlin by GavinMcG on Thursday May 18, 2017 @12:16AM (#14364766)
".." has a meaning – why are you leaving it out of the translation?
Re:Swift is like Kotlin by seanwilson on Thursday May 18, 2017 @02:17AM (#14365175)
I'd usually use ".." in the context of e.g. "2..3" to express a range but "<" to express a condition so I don't find it natural.
Re:Swift is like Kotlin by mikeash on Thursday May 18, 2017 @10:22AM (#14367423)
Add spaces for clarity:

  0 ..< count
I think Swift programmers should adopt this style.