How can I simulate macros in JavaScript? How can I simulate macros in JavaScript? javascript javascript

How can I simulate macros in JavaScript?


You could use parenscript. That'll give you macros for Javascript.


A library by Mozilla (called SweetJS) is designed to simulate macros in JavaScript. For example, you can use SweetJS to replace the function keyword with def.


One can also now use ClojureScript to compile clojure to javascript and get macros that way. Note ClojureScript uses Google Closure.