[armedbear-devel] Implementing non local exits in a runtime with structured exception handling

Erik Huelsmann ehuels at gmail.com
Thu Oct 15 09:40:01 UTC 2009

Hi Matthew,

On Thu, Oct 15, 2009 at 7:46 AM, Matthew D. Swank <akopa at charter.net> wrote:
> I am playing with a lisp dialect (at least in my head) that I am
> thinking about implementing on the CLR.  Like Java the CLR requires
> jumps across method call boundaries to be done using the exception
> handling mechanism.
> If I have code like the following in abcl:
> (block foo
>  (flet ((callback () (return-from foo t)))
>    (something-that-calls-into-java #'callback)
>    ... stuff that won't happen if the callback is invoked))
> And the plain old Java I'm calling into is pathological and catches the
> exception raised by calling the callback without re-throwing it, the
> non-local return never happens.  Is that correct?

That's correct.

> If so, is there no way around it?

Well, given that the work around would have a performance impact, I
wouldn't like to make it a generic one, but you could do this:

(block foo
  (let (boo)
    (flet ((callback () (setf boo t) (return-from foo t)))
    (something that calls into java #'callback)
    (when boo (return-from foo t))

I.O.W.: You can set a variable to be checked after you return from Java.

Hope that helps,


More information about the armedbear-devel mailing list