[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gcl-devel] compute-restarts
From: |
Camm Maguire |
Subject: |
Re: [Gcl-devel] compute-restarts |
Date: |
22 Oct 2002 10:52:20 -0400 |
Greetings! And thanks again Peter for looking into this.
Paul, I think that Peter is right here, and you want handler-bind
instead of handler-case. If you agree, could you please adjust the
tests, and I'll back out of the 'fix' I made in restart.lisp.
Take care,
Peter Wood <address@hidden> writes:
> On Tue, Oct 15, 2002 at 01:08:59PM -0400, Camm Maguire wrote:
>
> > > (handler-case
> > (make-package "A")
> > (error (c)(format t "restart-clusters is ~S~%"
> > conditions::*restart-clusters*)
> > (if (position 'abort (compute-restarts c)
> > :key #'restart-name :test-not #'eq)
> > 'success
> > 'failure)))
> >
> > in signal, restart clusters is ((#<RESTART.1>))
> > restart-clusters is NIL
> > FAILURE
> >
> > =============================================================================
> > When handler-case defines the new error processing lambda function, it
> > is appearing to carry with it the current *restart-clusters* as
> > opposed to the dynamically bound value at invocation time. Or
> > something similar. What I'd like to know is if this is the correct
> > lexical binding behavior, i.e. whether the bug is in handler.lisp, or
> > in the lexical binding. If the former, it would seem rather difficult
> > to know in LISP which variables need exporting in this manner amd in
> > which circumstances.
> >
> > Take care,
> >
> >
>
> Hi again,
>
> Is this what you are looking for?
>
> (defun pack-test (X)
> (handler-bind ((error #'(lambda (c)
> (if (position 'abort (compute-restarts c)
> :key #'restart-name :test-not #'eq)
> (progn (format t "(compute-restarts) =>
> ~S~%*handler-clusters* => ~S~%"
> (compute-restarts)
> conditions::*handler-clusters*)
> (invoke-restart (find-restart 'abort)))
> (progn (format t "FAILURE~%")
> (invoke-restart (find-restart
> 'abort)))))))
> (make-package X)))
>
> (pack-test "X") ;;=> #<"X" PACKAGE>
> (pack-test "X") ;;=>
>
> in signal, restart clusters is ((#<RESTART.2>))
> (compute-restarts) => (#<RESTART.2>
> #<RESTART.0>)
> *handler-clusters* => NIL
>
> Top level.
> >
>
> Regards,
> Peter
>
>
--
Camm Maguire address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah