Skip to content

(Perhaps) Remove Range/Loop Safety, So Folks Don't Have to Optimize #1952

Closed
@jashkenas

Description

@jashkenas

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.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions