4 ms·
Yes, if you really want the power of macros inside a browser ParenScript is the only real choice. I mentioned ParenScript at the end of the post. A ParenScript
by mnemonik 17y ago
Yes, if you really want the power of macros inside a browser ParenScript is the only real choice. I mentioned ParenScript at the end of the post. A ParenScript and Hunchentoot project is definitely on my TODO list for whenever I next have time off of school and work.
I'm sure Douglas Crockford would agree with you and say that JavaScript already has too many nasty and broken features (ie the DOM and "with") but I was just having some fun on my day off from work.
As others have pointed out, the expander can't even survive expansion, and using regexes for code parsing is a poor choice. Maybe, I haven't emphasized it enough, but I was just having some fun and imagining what it would be like to code with real macros in JS. I'm not advocating anyone actually use this code in any of their projects, nor that ECMAscript include simple template style macros in the spec.
That said, I wouldn't mind if someone built real lispy macros into a JavaScript implementation by forking Rhino or Spider Monkey. I'm convinced that this is possible despite the verbose syntax. Check this out: http://javascript.crockford.com/tdop/tdop.html http://javascript.crockford.com/tdop/tdop.html