From: John Williams
Subject: with-condition-restarts
Date: 
Message-ID: <3j4a8e$j3i@infa.central.susx.ac.uk>
Can anyone help with a query about WITH-CONDITION-RESTARTS?  I'm
currently implementing it for Poplog Common Lisp.

Suppose I have an active restart R, named N; and two conditions C1 and
C2. Then in the following form:

    (with-condition-restarts C1 (list R)
        (with-condition-restarts C2 (list R)
            (find-restart N C1)))

Should the call to FIND-RESTART return R or NIL?  I.e. does the most
recent association of R with C2 mask the earlier association of R with
C1?

Thanks for any replies,

John.
From: Barry Margolin
Subject: Re: with-condition-restarts
Date: 
Message-ID: <3j93gj$67l@tools.near.net>
In article <··········@infa.central.susx.ac.uk> ·····@cogs.susx.ac.uk (John Williams) writes:
>    (with-condition-restarts C1 (list R)
>        (with-condition-restarts C2 (list R)
>            (find-restart N C1)))
>
>Should the call to FIND-RESTART return R or NIL?

It should return R.  FIND-RESTART could be implemented as:

(defun find-restart (restart-id &optional condition)
  (etypecase restart-id
    (restart
     ;; Return RESTART-ID if it's active
     (when (member restart-id (compute-restarts))
       restart-id))
    (symbol
     (let ((possibilities (compute-restarts condition)))
       (find restart-id possibilities :key #'restart-name)))))
-- 
Barry Margolin
BBN Internet Services Corp.
······@near.net