Sweet.js - Sweeten your Javascript (by Mozilla)
github.com
github.com
I recognise that such a thing would run completely counter to Python's 'no magic' cultural values, but structural search-and-replace seems such an intoxicatingly powerful tool, I'd like to at least have the option to abuse it.
The thing about Perl is that there is supposed to be more than one way to do it. Which enables you to mix-and-match different paradigms in a way that the Python philosophy doesn't seem to welcome.
Or just use a Lisp.
For good or bad, it appears to be limited, with macros you probably can't, for example, make curly braces optional.
http://brendaneich.github.com/Strange-Loop-2012/#/41Seems like mozilla is trying to answer TypeScript. Which is really good.
Which is really good.
I don't think they know anything about TypeScript before it was made publicly available, which happened a week ago or so.
We have CofeeScript, TypeScript, LLJS (have no idea when this will be usefull), Sweet JS.
So It's about choices. That is good.
http://nodejs.org/api/globals.html#globals_require_extension...
Now I'm looking at the sweet.js source where they register the extension, and there's some additional magic I don't recognize; is module._compile documented somewhere that I just can't find, or is that getting added somewhere in the sweet.js code?
As an aside, here's the relevant bit of code that loads the (already compiled) source as a module: https://github.com/joyent/node/blob/master/lib/module.js#L40...
Hygenic macros are limited to 'safe' operations. They let you extend the language without creating opportunities for incredibly complex and hard to debug stuff like you can do with un-hygenic macros, for example C macros.