5 ms·
That really only applies to `define-macro` style macros. You can have syntax-case style macros if the language can disambiguate reading and parsing, which a lot
by jlongster 13y ago
That really only applies to `define-macro` style macros. You can have syntax-case style macros if the language can disambiguate reading and parsing, which a lot of them have trouble with, and why they don't support them.
sweet.js figured out how to do that in javascript, so we have full syntax-case macros just as easily.
- swannodette 13y agoWait so does sweet.js support arbitrary JS execution in macros now?
- jlongster 13y agoNot yet, but it's theoretically possibly with all the groundwork that's already been done. See https://github.com/mozilla/sweet.js/issues/12 https://github.com/mozilla/sweet.js/issues/12 So I should have said syntax-rules (for now). My bad!
- swannodette 13y agoSeems like you would still need to provide something like syntax objects and a special API to manipulate them?
- jlongster 13y agoThis involves a longer discussion, and I'm not sure what Tim is thinking along those lines. Suffice to say, Clojure's macros are always going to be the best, but I have pretty high hopes that you can get 95% of the way with sweet.js. :)
- disnet 13y agoYes indeed. Sweet.js already uses syntax objects internally so the groundwork is there for syntax-case. We "just" need to implement and surface the API :)