jashkenas/coffee-script — Issue #1952: (Perhaps) Remove Range/Loop Safety, So Folks Don't Have to Optimize
Author: jashkenas
Created: 2011-12-20 12:55:42+00:00
State: open

See the conversation here: http://news.ycombinator.com/item?id=3371171

Most of their work on the decoder went fine, but they ran into one area where (by default) CoffeeScript wasn't generating acceptable performance code, and had to coax it a little. Perhaps the original behavior we used to have is preferable? One commenter says:

> I've programmed in dozens of languages, and I can't think of another
> one where loops could automatically run either up or down depending
> on the start and end values.
>
> Not knowing CoffeeScript well, when I see this code:
>
> n = -10
> for i in [0...n] doSomething()
>
> I'd expect it to call doSomething zero times. At least that's what I'd expect
> in JavaScript or any of the other languages I've used.