This page is part of the web mail archives of SRFI 12 from before July 7th, 2015. The new archives for SRFI 12 contain all messages, not just those from before July 7th, 2015.
Date: Sun, 17 Oct 1999 09:54:20 -0400 From: Dave Mason <dmason@xxxxxxxxxxxxxxx> I'm not worried about explicit aborts in my program - I can do as you say. My concern is built-in low-level aborts. Like (/ x 0). If these dynamically create ``condition'' values, it will be expensive. What need is there for (/ x 0) to be cheap? And consing up a simple exception object shouldn't take a much time or a lot of memory. There are two different usages envisaged for exceptions, based on two different models: Machine-style exceptions: - used to extend the underlying Scheme implementation - handlers are installed rarely and have global extent - exceptions are frequent - restarts are common Programming-language-style exceptions: - used to return abnormal results across module boundaries - handlers are installed frequently and have dynamic extent - exceptions are rare - restarts are uncommon SRFI-12, with easy restarts and dynamic extent, is a little of each. It would be great if we could use the same mechanism for both, but the different requirements make it hard to satisfy everyone. Without restarts, WITH-EXCEPTION-HANDLER doesn't have to be exposed in the programming interface, and I see implementation approaches that could make HANDLE-EXCEPTIONS much lower cost. With restarts, you essentially need the dynamic-wind, call/cc pair to do HANDLE-EXCEPTIONS. HANDLE-EXCEPTIONS needs the call/cc because the handler it creates is called with HANDLE-EXCEPTIONS's continuation. That continuation needs to be saved somehow. Both HANDLE-EXCEPTIONS and WITH-EXCEPTION-HANDLER need DYNAMIC-WIND because that is the only portable way to give handlers dynamic extent. Both HANDLE-EXCEPTIONS and WITH-EXCEPTION-HANDLER can be done cheaply if you are allowed to fiddle with the underlying implementation. For that matter, if continuations are already in the heap, as in SMLNJ, and you have a reasonable implementation of DYNAMIC-WIND, the implementation given in SRFI-12 will be fairly zippy. -Richard Kelsey