Re:Stop Writing JavaScript Compilers, Make Macros Instead
by pfraze on Wednesday January 08, 2014 @02:30PM
(#7025877)
The syntax "crowding" could be solved by scoping macro rules. Maybe `macro class, foo, bar` at the top of the file?
[ Parent
| on HN ]
Re:Stop Writing JavaScript Compilers, Make Macros Instead
by jlongster on Wednesday January 08, 2014 @02:56PM
(#7026089)
The next big thing sweet.js is working on is modules. You will be able to actually pull in macros just like you would ES6 libs:
import { foo, bar } from "macros";
The scoping of macros will all stay in tact; any other macros from "macros.js" will be available, but the code that `foo` or `bar` expands to will be able to access them (this is really nice for helper macros and other things).
So yes, modules are going to be a big part of distributing and composing macros.
Re:Stop Writing JavaScript Compilers, Make Macros Instead
by 6cxs2hd6 on Wednesday January 08, 2014 @03:20PM
(#7026282)
Racket shows how, with strong module support, a whole "tower of languages a.k.a. macros" can work reliably. Else not so much.
Re:Stop Writing JavaScript Compilers, Make Macros Instead
by klibertp on Wednesday January 08, 2014 @05:02PM
(#7027063)
Also, macros in racket are lexically scoped. Any modern macro system should follow their design, IMHO.
Re:Stop Writing JavaScript Compilers, Make Macros Instead
by dherman on Wednesday January 08, 2014 @11:23PM
(#7028750)
Agreed, and happily sweet.js is very consciously modeled after Racket.