There is a lot to love here
comptime– Execute arbitrary async logic during compilation. Inline API data or Platform-Specific code or pre-calculate complex math before the code even reaches the user.
We want something like this and we have some ideas about it, especially @jfrolich
macro– Native compile-time code generators. Splice logic directly into your source at call sites with!syntax.
ReScript will use a different approach here. https://github.com/rescript-lang/rescript/blob/dabd22381b389c95c9e6fd6e4029d95ad3b98c1c/docs/EmbedLang.md
defer/queue– Reliable scope-exit cleanup (LIFO/FIFO), similar to Go and Zig.
Does it compile to using by any chance?
- Pipe Operator (
|>) – Clean, functional chaining for readable data processing.
This should be default in all modern languages and I find it weird that it’s not the case. Is this piping the first argument like ReScript or the last, like most other functional languages?
matchExpressions – A powerful, expression-based version ofswitchthat returns values directly.
So it’s not mainly expression-based then? One switch/match keyword ought to be enough in practice. Except if you want to be a superset of JS like TS?
- Ergonomic Loops – Built-in
repeat N,forever, andunlessfor cleaner control flow.
Inspiring. Loops are still not as ergonomic in ReScript as in plain JS and I am not sure if being familiar for JS is still a good bet anyways.
- Native Escape Hatch – Use
js { ... }blocks to write raw JavaScript without the compiler interfering.
similar to ReScript’s %raw
is it also sound, or gradually typed?