News for hackers. Stuff that matters.
Re:Swift is like Kotlin by ridiculous_fish on Thursday May 18, 2017 @12:16AM (#14364765)
How is the inclusive range operator implemented in Kotlin? Something like `for (i in 0..count)` needs to iterate count + 1 times, which may overflow the size of count's type - annoying to implement.
Re:Swift is like Kotlin by coldtea on Thursday May 18, 2017 @02:55AM (#14365322)
>needs to iterate count + 1 times, which may overflow the size of count's type - annoying to implement

How's that different from:

  for (int i=0; i<=count; i++)
in e.g. C99?
Re:Swift is like Kotlin by chc on Thursday May 18, 2017 @02:38AM (#14365243)
I don't see where the overflow would come into play since count is the terminal value and count is necessarily representable in its type.
Re:Swift is like Kotlin by kaeawc on Thursday May 18, 2017 @12:25AM (#14364810)
In Kotlin it's much more common to write the following, which is exclusive:

   count.forEach {
      // do things
   }