Unshackling JavaScript with Macros
summary
A working macro system called sweet.js implements hygienic macros that add an expansion phase before parsing and compiles invalid JavaScript into valid code, enabling ES6 destructuring, classes and fat‑arrow syntax plus function tracing and pattern matching. It preserves scopes to avoid name collisions, generates source maps (sjs -c), ships via npm, and is already used to prototype language features instead of waiting years for ECMA standardization; a related blog post reached about 50,000 views.
AI-written summary · about
chapters (9)
- 0:00Start
- 12:26pattern classes
- 14:57'let' macros
- 15:55repeating patterns
- 17:55hygiene
- 20:25infix macros
- 22:47case macros
- 31:50want static allocation?
- 32:05want pattern matching?
related talks
28mPattern Matching in JS
23mI Can Babel Macros (and So Can You!) - Shawn "swyx" Wang
56mJS.Next and CoffeeScript
49mECMAScript 6, The Future of JavaScript
20mLearning New Words
29mJavaScript in JavaScript: Inception
34mTowards a simpler JavaScript ecosystem
29mExtending JavaScript Libraries from ClojureScript
