Sat Jan 18 21:23:10 CET 2020
those 4 stack-only control structures, revisited
- function call:
- hide current frame (essential!)
- append new frame (args & params)
- tail call:
- remove current frame
- replace with new ...
- inlined form
- keep current frame
- hide form's control frame
- append new frame
- same, tail call version, might not be necessary?
Hiding the caller's frame is essential, because the function can be
used at any point. The invisibility is an enabling property!
I re-invented the frame pointer.
To represent a function call: store return point and previous stack
frame. This is exactly what happens in C function calls.
Tail call will likely need a memcpy to prepare the new frame on top of
the old one (or the C stack), and put it in place. Also not really
The interesting part is the inlined forms.
This is what is "new" in the language.
But.. the only one that I'm going to need is a Rust-like "for".
The more I think about this, the more it is obvious that I should not
write the closure compiler, but use Rust instead.
Keep the CSP at what it is: something simple.
Still. It's a nice exercise.