https://bugzilla.mozilla.org/show_bug.cgi?id=618650
https://bugs.webkit.org/show_bug.cgi?id=30933
In the meantime, CoffeeScript tries to make debugging easy by compiling to straightforward, readable JS, with meaningful variable names, normal indentation, and all that. Patches to make the output clearer/cleaner for specific bits are always welcome.
http://jashkenas.github.com/coffee-script/#loops
To be clear, I think CoffeeScript is an impressive language/abstraction. I just get tired of people selling the Javascript output as always being "straightforward" and "readable".
The only difference from a "hand-written" loop is that you would use `i` and `ln` instead of `_i` and `_len`, and something in context like `numbers` instead of `_results`.
You're also overlooking the fact that this can be considered an advantage: variable naming for these transient uses is very consistent. When writing JS you could have names all over, even a different one for every loop.
var i, foods = ['toast', 'cheese', 'wine'], foods_length = foods.length;
for (i = 0; i < foods_length; i++) {
eat(food[i]);
}
Prefixing variables with an underscore is not an advantage in readability because it lends nothing to the description of what the variable represents. Its another glyph that you have to visually parse before reaching possible meaning.I said consistency is good. And you just proved my point.
alert(var one = 2);
In CoffeeScript, (nearly) everything is an expression. So you need to be able to do this: alert one = 2
By pushing up all the var declarations, all assignments can be themselves assigned, returned, or passed as arguments to function calls directly.Client-side is zero problem because the chrome and firebug developer tools jump you right to the line in the JS file, and you can figure out where the error is there since the compiled coffeescript is very readable.
Server-side has a slight hassle since there's no clickable link, so the line numbers don't help much, but a quick look at the stack trace makes it pretty easy to find where in the coffeescript its referring to.
Most of the problems we’ve dealt with have been due to using new syntax, figuring out when we need parentheses/how to pass anonymous functions, and so on.
Referring to the compiled output definitely helps, but we’re pretty familiar with JS at this point. Not sure how difficult it would be for those with less experience.