3 ms·
I don't know if this is their motivation for it, but SpiderMonkey implements many useful non-standard features, including generators and iterators. JS 1.5: htt
by ivank 16y ago
I don't know if this is their motivation for it, but SpiderMonkey implements many useful non-standard features, including generators and iterators.
JS 1.5: https://developer.mozilla.org/en/JavaScript/New_in_JavaScript/1.5 https://developer.mozilla.org/en/JavaScript/New_in_JavaScrip...
JS 1.6: https://developer.mozilla.org/en/JavaScript/New_in_JavaScript/1.6 https://developer.mozilla.org/en/JavaScript/New_in_JavaScrip...
JS 1.7: https://developer.mozilla.org/en/JavaScript/New_in_JavaScript/1.7 https://developer.mozilla.org/en/JavaScript/New_in_JavaScrip... <- generators, iterators, and more
JS 1.8: https://developer.mozilla.org/en/JavaScript/New_in_JavaScript/1.8 https://developer.mozilla.org/en/JavaScript/New_in_JavaScrip...
(As a side note, I once implemented Twisted's inlineCallbacks in JS 1.7; this worked because it had those Python-like generators. Too bad it doesn't work anywhere but SpiderMonkey.)
- pcwalton 16y agoThose features are a lot of the reason for it, yes. As a cool example of what can be done with generators, check out my colleague Dave Herman's task.js library: https://github.com/dherman/taskjs https://github.com/dherman/taskjs That library gives you coroutine-style I/O on top of node.js primitives, which is, as far as I can tell, the #1 feature people have been asking for all along in Node. It only works if node.js implements coroutines (which Ryan has so far refused to do) or if the language implements generators (which you get with SpiderMonkey).