Re:CoffeeScript -- You Are Totally Gonna Hate It
by confuzatron on Saturday July 17, 2010 @11:09AM
(#1523887)
What's the debugging experience like?
[ Parent
| on HN ]
Re:CoffeeScript -- You Are Totally Gonna Hate It
by jashkenas on Saturday July 17, 2010 @11:30AM
(#1523927)
As a source-to-source language, we try to keep debugging sane by outputting pretty-printed JavaScript that shouldn't be too hard to debug. For example, dropping you right into the middle of the JavaScript that's generated for the CoffeeScript Lexer looks like this:
http://github.com/jashkenas/coffee-script/blob/master/lib/le...
Pretty readable. You can use a Webkit or Firebug debugger just as you would with normal JS. It's a golden rule (with one small exception) that there are no CoffeeScript-specific constructs or special functions added to the runtime, no matter how tempting it might be to do so.
The single largest headache in practice is having to refer to the generated JS if the exception is vague, and just includes a line number. But I'm not sure that there's anything we can do to mitigate that, other than to keep the JS readable...
Re:CoffeeScript -- You Are Totally Gonna Hate It
by karlokeeffe on Saturday July 17, 2010 @11:35AM
(#1523936)
The debugging experience is surprisingly good. CoffeeScript is pretty much a one-to-one conversion into JavaScript. This makes it easy to work out which line of JavaScript was generated by which line of CoffeeScript, and debug the CoffeeScript directly.
I find I don't often need to look at the compiled JavaScript very often, but it is perfectly readable to do so if required.