[Cuis-dev] Exception handler blocks with non-local returns

ken.dickey at whidbey.com ken.dickey at whidbey.com
Tue Oct 15 08:00:39 PDT 2019


On 2019-10-15 04:12, Hernan Wilkinson via Cuis-dev wrote:

> On the other hand, I just try this issue in other languages.

Moby deep complexity.

For completeness, this is how I handled the #on:do: #retry #outer etc. 
semantics in Scheme.

I am sure that no-one really wants to see this, but I did an 
implementation model of core Smalltalk in Scheme (repository 
https://github.com/KenDickey/Crosstalk) which passes the Smalltalk 
exception unit tests ported from Cuis.

In Scheme call/cc captures the current continuation and acts as a "first 
class label", which means you can jump to it (a procedure call is a jump 
which may have arguments) and the dynamic evaluation context is properly 
wound/unwound (see literature on "dynamic wind").

It has been some years since I looked at this and I no longer have a 32 
bit OS to run it on.  I would have to do some work to get the code 
running on a 64 bit Scheme implementation.

If you are brave enough to look, you will see that call/cc is used in a 
number of places to capture the local context so that it can be jumped 
out of and then back into.

Note that you can invoke the same continuation multiple times in Scheme.

FYI,
-KenD
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: except.scm
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191015/07f69bde/attachment-0001.ksh>


More information about the Cuis-dev mailing list