Sweet.js brings hygenic macros to JavaScript.
Now that’s the same as in lisp like languages with all its glory. Now this gives full power to bend the language as we wish. i.e., create a different looping constructs etc. Doesn’t OMeta (which actually was mentioned by Krilnon somewhere before) allow to achive similar behavior? I understand the macro concept, but doesn’t have a full understanding on how the macro system itself is created. It must be using similar some kind of lexers and parsers right?
Next, I hear about AST (Abstract Syntax Tree) transformation that allow one to write DSLs (having Groovy in mind, but applies to other langauges like python). Now AST transformations means we are hooking into the compiler and modifying the initial generated AST or something right? It’s not really macros and no where close, I think. Can anyone clarify.
Hygenic macros provides a straight forward way to having DSLs, right?