logoalt Hacker News

aagyesterday at 6:38 PM2 repliesview on HN

Does anyone know whether the exception handling implementation supports restartable exceptions like Common Lisp's and Scheme's?


Replies

phoe-krkyesterday at 6:52 PM

Speaking for CL, it seems so for me.

The whole magic about CL's condition system is to keep on executing code in the context of a given condition instead of immediately unwinding the stack, and this can be done if you control code generation.

Everything else necessary, including dynamic variables, can be implemented on top of a sane enough language with dynamic memory management - see https://github.com/phoe/cafe-latte for a whole condition system implemented in Java. You could probably reimplement a lot of this in WASM, which now has a unwind-to-this-location primitive.

Also see https://raw.githubusercontent.com/phoe-trash/meetings/master... for an earlier presentation of mine on the topic. "We need means of unwinding and «finally» blocks" is the key here.

titzeryesterday at 8:35 PM

No, that functionality would fall under the stack-switching proposal, which builds on the tags of Wasm exception handling.