4 ms·
> But, as Scheme has demonstrated, once the virtual machine supports tail calls, a compiler can implement exceptions and cooperative multithreading by way of co
by light_hue_1 4y ago
> But, as Scheme has demonstrated, once the virtual machine supports tail calls, a compiler can implement exceptions and cooperative multithreading by way of compiling to continuation-passing style. So this is not the beginning of a long series of extensions; it's Lambda the Ultimate Goto.
Well to an extent. CPS can be extremely slow.
Scheme shows that continuations will also be needed down the road. But yes, that's about it.
- kragen 4y agoIn theory CPS is very fast indeed, but of course our hero can easily collapse attempting to cross the chasm of the Sufficiently Smart Compiler. I suspect Chicken using CPS for everything is the main reason http://canonical.org/~kragen/urscheme http://canonical.org/~kragen/urscheme, which doesn't implement call/cc, is so much faster than Chicken.
- naasking 4y agoIIRC, one shot continuations can be made pretty efficient, effectively folding back into a single stack. If there's a simple way to safely express this in wasm that might be the right balance. If you want multishot continuations you'd need to explicitly clone the one-shot continuation.
- yw3410 4y agoI think koka uses a different approach for its multishot continuations than scheme as well.