Re: %active-restart

Alan Ruttenberg <[email protected]> Wed, 31 Aug 2005 22:43:03 -0400
Newsgroups gmane.lisp.openmcl.bugs
Message-ID <[email protected]>
   (restart-bind ((handler (lambda())
            :test-function (lambda(condition) <decide if you want to  
handle this condition based on the type of condition>)
            :interactive-function (lambda() <do something>)
            ))

I think this needs to be called when deciding which restarts to  
offer, which it is, and the restart is offered. But then when the  
restart is invoked %active-restart is called, it calls this again,  
this time not passing the condition. The test fails and you get the  
inactive-restart error, even though the test passed the first time  
and it is in fact an active restart.

The relevant piece of documentation from the hyperspec entry on  
restart-bind which specifies the test function

:test-function

Value is evaluated in the current lexical environment and should  
return a function of one argument, a condition, which returns true if  
the restart is to be considered visible.

-Alan

On Aug 31, 2005, at 6:36 PM, Gary Byers wrote:

> Sorry I missed this.
>
> I'm not sure if this is correct (though I also have to confess that I
> remember how any of this works at most once a year.)
>
> Exactly how CCL::%ACTIVE-RESTART behaves isn't necessarily of direct
> concern (since it's a random internal function), but it would be of
> concern if it causes some public function to misbehave.  Can you think
> of a case where it does so ?
>
> (Sorry if I'm missing the obvious.)
>
> On Thu, 25 Aug 2005, Alan Ruttenberg wrote:
>
>
>> (defun %active-restart (name)
>>  (dolist (cluster %restarts%)
>>    (dolist (restart cluster)
>>      (let* ((rname (%restart-name restart))
>>         (rtest (%restart-test restart)))
>>    (when (and (or (eq restart name) (eq rname name))
>>           (or (null rtest) (funcall rtest nil)))
>>      (return-from %active-restart (values restart cluster))))))
>>  (error 'inactive-restart :restart-name name))
>>
>> This calls the restart-test on nil instead of the condition in  
>> question. Is that correct?
>>
>> -Alan
>> _______________________________________________
>> Bug-openmcl mailing list
>> [email protected]
>> http://clozure.com/mailman/listinfo/bug-openmcl
>>
>>
>