Implementation of SIGNAL and ERROR in CLRHack In CLRHack, the condition signaling system is implemented in the Lisp.HandlerControl class within the LispBase library. It leverages .NET's [ThreadStatic] storage to maintain a per-thread dynamic stack of active condition handlers. SIGNAL Implementation The Signal(object condition) method performs the following logic: Retrieval: It fetches the activeHandlers list for the current thread. This list is a chain of [LispBase]Lisp.Handler objects maintained by handler-bind. Iteration: It iterates linearly through the list from the most recently bound handler to the oldest. Type Matching: For each handler, it calls IsType(condition, handler.ConditionType). If the condition is a symbol, it checks for symbol equality (supporting simple symbol-based conditions). If the condition is a .NET object, it checks if the handler's type is assignable from the condition's runtime type (supporting interop with system exceptions). It treats the symbols T or…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.