A modular (but opinionated) macro based extension of the JavaScript runtime
ES6 isn't perfect. There are some strange language choices and while at the runtime level we are stuck with what ECMA declares, at a syntactic and semantic level we have some degree of freedom as to what the code we write gets commpiled from.
Babel's AST based approach, while modular under the hood, only allows plugins via a poorly documented and fragile API. This isn't to say that Babel is bad, just that it's maintainers goals are focused on providing the ES6 API and so plugins and additions are not first-class citizens.
As of now we plan on using Mozilla's Sweet.js macro system.
- Implement ES6/7/* features as pluggable macros for the Sweet community
- Implement new language features from external communities (PureScript/Haskell, Elm, Clojure, etc)
- Implement syntactic sugar on top of ES6 runtime, which could then be passed to an ES6 transpiler if your runtime does not support it.
- Macros should be coupled only to the declarative structure, any non-runtime logic should be pluggable with external implementation or the internal provided one (e.g. write your own curry function or just use the Ramda we plug in).
- Target the ES6 runtime
f(x) |> g |> h === h(g(f(x)))
f * g * h(x) === f >> g >> h(x) === f(g(h(x)))
Sparkler exists, but I'm not sure how I feel about reusing the arrow syntax.
Could we use the OCaml/F#-esque |
syntax instead?
const patternExample ->
| [] -> null
| [...front, back] -> back