Re:Web Scraping with Node.js and Chimera
by niggler on Wednesday January 02, 2013 @08:31PM
(#5000562)
Did we really reach the point where demonstration code can be presented in coffeescript without an equivalent javascript demo?
[ Parent
| on HN ]
People have been doing that for a surprisingly long time. I think it was encouraged by the fact that CoffeeScript is immediately intelligible to a lot of JavaScript coders, and authors reckon that anyone who has trouble can just compile it and get fairly idiomatic JavaScript.
I actually wrote a bookmarklet a while back that would look for CoffeeScript snippets on a page and translate them for people who find it troublesome, but didn't end up doing much with it because I didn't feel like there was much interest.
Re:Web Scraping with Node.js and Chimera
by niggler on Wednesday January 02, 2013 @09:05PM
(#5000681)
criticisms of coffeescript aside (e.g. interstitial whitespace sensitivity), the code can't directly be applied in node (as far as i can tell, you can't tell node to run a coffeescript file directly using the `node <script>` syntax -- you have to use a framework or compile to js).
Re:Web Scraping with Node.js and Chimera
by bdcravens on Wednesday January 02, 2013 @11:54PM
(#5001086)
Check out the PeepCode "Full Stack node.js" screencasts - it shows building a full app using CoffeeScript.
Re:Web Scraping with Node.js and Chimera
by rcsorensen on Wednesday January 02, 2013 @10:05PM
(#5000840)
It can after you install coffee-script.
$ echo 'process.stdout.write "Now with CS level #{1 + 2}!"' > foo.coffee
$ coffee foo.coffee
Now with CS level 3!
$If you don't want to compile, assuming you have CoffeeScript installed, you can just run it with coffee instead of node and everything else works like normal.
Re:Web Scraping with Node.js and Chimera
by funkiee on Wednesday January 02, 2013 @09:10PM
(#5000695)
How is that really different toolchain-wise from having to compile source code in a language such as Java?
Re:Web Scraping with Node.js and Chimera
by niggler on Wednesday January 02, 2013 @09:21PM
(#5000733)
remember: java is to javascript as pain is to painting.
it's not an apt comparison. You can directly write javascript and run it in your browser or in node (or test it out interactively in the node REPL).
I like to play with modules in node interactively (when relevant) because its easier to see what's going on and much easier to iterate (esp. in conjunction with the .load REPL command)
otf compiling is pretty simple regardless.
index.js:
require('coffee-script')
module.exports = require('app.coffee')
Re:Web Scraping with Node.js and Chimera
by catch23 on Thursday January 03, 2013 @12:24AM
(#5001156)
The github project does have examples in standard javascript as well:
https://github.com/deanmao/node-chimera/blob/master/example....