News for hackers. Stuff that matters.
Re:Offer HN: I'll answer your javascript questions by barrydahlberg on Saturday December 18, 2010 @01:43AM (#2019066)
Have you tried CoffeeScript and what are your thoughts on it? It's clearly not 'done' yet but I found it really helps clean up my scripts, reduce the amount of typing and avoid a lot of tricky JavaScript mistakes.
Re:Offer HN: I'll answer your javascript questions by ramanujan on Saturday December 18, 2010 @02:26AM (#2019112)
Coffeescript is great in theory. The problem is that when debugging stuff in the browser, you're going to be looking at Javascript in Chrome Developer Tools or Firebug. You can hopefully do an inverse mapping from generated JS to the corresponding line in Coffeescript...but that's kind of a pain, especially because it's not a line for line conversion.

Short of patching Chrome Dev Tools to support stepping through Coffeescript itself, not sure how to fix that.

Re:Offer HN: I'll answer your javascript questions by jashkenas on Saturday December 18, 2010 @08:27AM (#2019454)
The truth, (and a big part of the reason why we haven't already tried to solve this), is that it hasn't posed a problem for folks who are building apps in CoffeeScript. The transformation is straightforward enough that by glancing at the line number mentioned in the JavaScript, it's immediately obvious where the problem is in the CoffeeScript.

That said, I'd love to have a true solid debugger. The browser vendors (starting as soon as Firefox 4, perhaps) have plans to add better support for compile-to-JavaScript languages.

https://bugzilla.mozilla.org/show_bug.cgi?id=618650

http://intertwingly.net/blog/2010/11/25/Hobgoblin-of-Little-...

Re:Offer HN: I'll answer your javascript questions by pdelgallego on Saturday December 18, 2010 @06:10PM (#2020551)
>The browser vendors (starting as soon as Firefox 4, perhaps) have plans to add better support for compile-to-JavaScript languages

That are great news, Do you thing we will see many new languages that compile to JS in the near future?

Re:Offer HN: I'll answer your javascript questions by psykotic on Saturday December 18, 2010 @02:51AM (#2019125)
That's a pretty lame excuse. There also isn't a simple line for line relationship between C code and x86 code or C# code and MSIL code. But there's a standard solution to this problem when debugging: let the compilers generate mapping information.

For something like CoffeeScript, you'd probably have a debug compilation mode where each line of generated code is annotated with comments containing line numbers or full lines of code from the original CoffeeScript source code. It wouldn't be as convenient as a true source-level debugger for CoffeeScript, but it should suffice.

Re:Offer HN: I'll answer your javascript questions by Scriptor on Saturday December 18, 2010 @05:18AM (#2019272)
As far as I'm aware, there is no such debugging mode for CoffeeScript. The current method of debugging really is to look in the JS and then find the corresponding CS code. They do make this easier by keeping the JS code as readable as possible.
Re:Offer HN: I'll answer your javascript questions by psykotic on Saturday December 18, 2010 @09:33AM (#2019534)
Oh, I know. I was saying that it would be doable to implement.