[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gcl-devel] proposed find-restart bugfix
From: |
Camm Maguire |
Subject: |
Re: [Gcl-devel] proposed find-restart bugfix |
Date: |
20 Oct 2002 19:16:58 -0400 |
Hi Peter! Thanks for looking into this!
1) I added an optional condition argument to compute-restarts a little
while ago to address some test failures Paul was seeing. It was
just a placeholder argument, i.e. it is currently ignored, as there
is no 'slot' in the restart structure yet to support it. This
would be straightforward to add, but I'd let this mini-project wait
for a while due to 2). This is why the item is still active on the
web site.
2) There appears to be a possible lexical scope issue with the
*restart-clusters* handling. I put in some work around to
clcs/handler.lisp so that Paul's tests could detect a restartable
('correctable') package error, but was a bit confused as to why this
should be necessary. Paul had written that I should ignore the
restart code for now as he was unsure if the tests were accessing this
information correctly.
3) The background discussions should still be accessible via the recent
mailing list archives.
4) This having been said, your patch looks fine to me, but will
obviously need to be supplemented as in 1) and 2). You might want
to slightly modify to something like this for readability:
(defun find-restart (name &optional condition)
(let ((restarts (if condition (compute-restarts condition)
(kcl-top-restarts))))
(dolist (restart restarts)
(when (or (eq restart name)
(eq (restart-name restart) name))
(return-from find-restart restart)))))
If you would like to commit either one, that would be fine with me.
Please note that should some analogous patch be committed to a lsp
file in the lsp or cmpnew directories, the corresponding .c, .h, and
.data files would have to be remade and committed as well. In this
case, the lisp patch alone will suffice given the way the build is
currently structured.
Take care,
Peter Wood <address@hidden> writes:
> Hi
>
> On the Savannah bug page for GCL, (Task #1521)
>
> http://savannah.gnu.org/pm/task.php?func=detailtask&project_task_id=1521&group_id=879&group_project_id=375
>
> "Summary: (ANSI) COMPUTE-RESTARTS should take an optional parameter"
>
> I believe there was a typo here, since #'compute-restarts _does_ take
> an optional parameter (a condition). Perhaps the report should have
> refered to #'find-restarts which should (but doesn't in current GCL).
>
> Anyway, here is a lightly tested proposed bugfix:
>
> (in-package "CONDITIONS")
>
> (defun find-restart (name &optional condition)
> (if condition
> (let ((restarts (compute-restarts condition)))
> (dolist (restart restarts)
> (when (or (eq restart name)
> (eq (restart-name restart) name))
> (return-from find-restart restart))))
> (let ((restarts (kcl-top-restarts)))
> (dolist (restart restarts)
> (when (or (eq restart name)
> (eq (restart-name restart) name))
> (return-from find-restart restart))))))
>
> (in-package "COMMON-LISP-USER")
>
> Example usage:
>
> >(find-restart 'abort)
>
> #<RESTART.0>
>
> >(find-restart 'abort (make-condition 'error))
>
> #<RESTART.0>
>
> >(find-restart 'foo )
>
> NIL
>
> >(find-restart 'foo (make-condition 'error))
>
> NIL
>
> May I check in this bugfix?
>
> Regards,
> Peter
>
>
>
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gcl-devel
>
>
--
Camm Maguire address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah