4 ms·
I think that if you have an escape hatch for something like numbers, it will get abused to the point where the language is incomplete without it, and you have t
by alexisread 3y ago
I think that if you have an escape hatch for something like numbers, it will get abused to the point where the language is incomplete without it, and you have two problems ;)
I'd also agree about your ideal. Maru for a long time was my goto reference as it's small, has a compiler to x86, is self-hosting, and has fexprs as a fundamental design choice.
The main issue with Maru, aside from being coded in C (bootstrapping from fundamentals), is that environments are implicitly dynamic, with no static control.
https://github.com/GiacomoCau/wat-js https://github.com/GiacomoCau/wat-js
has explicit dynamic variable handling, it uses the concept of wrap aka quotation plus env to determine what gets evaluated from the runtime env vs the compile time (static) env.
One thing I'm less keen on, is the use of macros. I feel Zig has the right approach with a compiletime annotation.
Wat also handles delimited continuations, which you can build an algebraic effect system on. Thus you can get multithreading, fibers, async, exception handling, IO, actors etc. very easily in little code.
Wat also has modules.
Forth is like a super power for bootstrapping, but is unopinionated and for higher level coding, could use more of the techniques from Wat.
You might want to look at
https://github.com/dan4thewin/FreeForth2/blob/master/ff.asm https://github.com/dan4thewin/FreeForth2/blob/master/ff.asm
It compiles anonymous functions (words) at the shell. It may be possible to use this technique with dynamic variable handling to get an eager bound system when required.