185 days ago · Tech · hide · Fediverse post

In the CLRHack compiler, restart-bind is a primitive form that manages the dynamic lifecycle of Common Lisp restarts by manipulating a thread-local stack of active restart objects. Handling of restart-bind When the compiler encounters a restart-bind form, it generates CIL code that performs the following steps: Capture Previous State: It calls Lisp.RestartControl::GetActiveRestarts() to retrieve the current list of active restarts and stores it in a frame-local variable. Construct New List: For each binding, it evaluates the restart name, handler function, and optional keyword arguments (:report-function, :interactive-function, :test-function). It then instantiates a new [LispBase]Lisp.Restart object and conses it onto the existing list. Install New State: It calls Lisp.RestartControl::SetActiveRestarts(new_list) to update the dynamic environment. Protected Execution: The body of the restart-bind is wrapped in a CIL .try block. Restoration: A finally block is emitted that restores the…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town