I love CoffeeScript, except that it makes me hate writing javascript code now :) Thanks @jashkenas for an amazing language. I personally like code like this: countNeighbors: (cell) -> neighbors = 0 neighbors += @isAlive cell.row+x, cell.col+y for x in [-1..1] when x || y for y in [-1..1] neighbors isAlive: (row, col) -> if @world[row] and @world[row][col] and @world[row][col].live then 1 else 0 but you have to be car…
Yes, range comprehensions were recently optimized to remove direction-checking when possible. On CoffeeScript master ...
x for x in [-10..10]
... compiles into: var x;
for (x = -10; x
Even if the start/end values are variables, the check can be avoided by specifying the step as a number. It'll go out with the next release.