guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SRFI 34


From: Neil Jerram
Subject: Re: SRFI 34
Date: 17 May 2003 10:39:22 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>>>> "Marius" == Marius Vollmer <address@hidden> writes:

    Marius> Neil Jerram <address@hidden> writes:
    >> As part of "looking", I've written and committed a first
    >> implementation of SRFI 34.

    Marius> Nice!  I think I like SRFI 34.  Just the essential bits...

    Marius> Anyway, I sense trouble with our lazy-catch:

    guile> (define f (make-fluid))
    guile> (lazy-catch #t (lambda ()
    Marius>                             (with-fluids ((f 12))
    Marius>                               (throw 'x)))
    Marius>                           (lambda (x)
    Marius>                             (pk 'handler (fluid-ref f))))

    Marius>     ;;; (handler #f)

    Marius> Shouldn't this print '(handler 12)' since the handler is
    Marius> supposed to be running in the dynamic context of the
    Marius> throw?

Our lazy-catch implementation specifically unwinds dynamic context so
that we see (handler #f) here rather than (handler 12).  Effectively
the only thing that lazy-catch doesn't unwind is the stack.  I've
described this current behaviour in some detail in the manual.

Unwinding the fluid context is contrary to my intuition, though, and
it appears to yours also.

So perhaps we should consider changing it.  Right now, fluids, dynamic
winds and catches are all on the same wind list, which means we have
to unwind the list to get the right catch context for the lazy-catch
handler's throw.  One option then would be to have separate wind lists
for separate kinds of dynamic context, and only unwind the list with
the catches in it.  But I wonder if there are strong theoretical
reasons why having separate wind lists would be a bad thing?

        Neil





reply via email to

[Prev in Thread] Current Thread [Next in Thread]