Re:A Quick Node.js Jumpstart
by joevandyk on Friday April 08, 2011 @06:01PM
(#2425773)
You should be using coffeescript though, makes the javascript in the example look like:
And if you want to get rid of that "gotcha" (which is a javascript one, not a node.js one):
This will output the number you'd intuitively inside the file read callback function.
[ Parent
| on HN ]
do you need to preprocess the coffescript somehow before node runs it, or will node run it directly?
Re:A Quick Node.js Jumpstart
by marcomonteiro on Friday April 08, 2011 @09:26PM
(#2426219)
You have to compile it.
Not necessarily. The distributed `coffee` script will automatically compile before running the script. Plus it shows you coffeescript-friendly tracebacks on error.
Re:A Quick Node.js Jumpstart
by marcomonteiro on Saturday April 09, 2011 @07:40PM
(#2428412)
Whether I manually compile it or it's automatically compiled it still has to be compiled which was the question I was responding to. Which is to say Node.js will not run CoffeeScript directly.