Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Indeed a clear syntax.

OTOH, a "loop .. for .. {upto, below} count" leaves less questions in a casual code review :)



I prefer explicit words over symbols, like in Scala:

scala> 1 to 3

scala.collection.immutable.Range.Inclusive = Range(1, 2, 3)

scala> 1 until 3

scala.collection.immutable.Range = Range(1, 2)


As someone who's never programmed in Scala, it's not intuitive to me at all that "until" means exclusive, given that "to" (which is basically a synonym) means inclusive.


How would you feel about

  > 1 through 3
  # [1, 2, 3]

  > 1 until 3 # or 1 to 3
  # [1, 2]
as explicit word range notation?


Agreed, Scala's approach to ranges is one of the best out there from my experience.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: