Re:Sweet.js – Hygienic Macros for JavaScript
by sawyerjhood on Wednesday July 17, 2019 @04:24PM
(#20463581)
It is a little bit of a shame that it doesn't seem to be under active development anymore. For personal projects, it would be fun to be able to write up little DSLs
[ Parent
| on HN ]
Re:Sweet.js – Hygienic Macros for JavaScript
by hombre_fatal on Wednesday July 17, 2019 @04:59PM
(#20463952)
It seemed to undergo a major rewrite and then died.
I could also never really figure it out post-rewrite. Pre-rewrite, I had made some cool macros just out of intuition after reading some of its examples. Now, I can't get many of its own examples to compile in its live editor.
Too bad. It's about 1000x simpler than, say, implementing low-level Babel transformations.
Re:Sweet.js – Hygienic Macros for JavaScript
by yuchi on Wednesday July 17, 2019 @05:25PM
(#20464202)
I feel the pain. Things got a little bit easier with Babel Plugin Macros and Typescript (which forces you to build macros that adhere to a reasonable type system)
Re:Sweet.js – Hygienic Macros for JavaScript
by lioeters on Wednesday July 17, 2019 @10:23PM
(#20466143)
I've only recently learned about Babel Plugin Macros and haven't used it in production - but here are a few links in case anyone's interested.
https://babeljs.io/blog/2017/09/11/zero-config-with-babel-ma...
https://github.com/kentcdodds/babel-plugin-macros
https://github.com/jgierer12/awesome-babel-macros
These "macros" take a different approach than Sweet.js: they're not syntax extensions, but rather code transformers that you import and use explicitly.