[Openmcl-devel] INVOKE-RESTART bug

Tim Bradshaw tfb at tfeb.org
Tue Jun 22 02:34:39 PDT 2010


On 21 Jun 2010, at 22:29, Daniel Weinreb wrote:

> But what if the test function isn't called at all, because
> the program called find-restart, compute-restart, or
> invoke-restart without passing any condition argument?

The test should still be called then, but with an argument of NIL.   
 From FIND-RESTART:

If identifier is a symbol, then the innermost (most recently  
established) applicable restart with that name is returned. nil is  
returned if no such restart is found.

And from the definition of "applicable restart":

2. (for no particular condition) an active handler for which the  
associated test returns true when given nil as an argument.

As far as I can see, the situation is reasonably clear: if FOO has a  
test which returns NIL when given NIL as an argument, then (FIND- 
RESTART 'FOO) should return NIL.  The problem seems to be, I think,  
whether INVOKE-RESTART should cause the test to be run as well, and I  
think the answer ought to be as follows.

I think (INVOKE-RESTART 'FOO) is essentially (INVOKE-RESTART (FIND- 
RESTART 'FOO)_ which is essentially (from above) (INVOKE-RESTART (FIND- 
RESTART 'FOO NIL)).  So in that case, INVOKE-RESTART will (indirectly)  
call the test, with NIL as its argument.

But if have a restart object (not just a symbol which may or may not  
name one), then I think INVOKE-RESTART should just get on and run it:  
it's too late now to run the test.  This allows the possibility of  
getting hold of a restart under false pretences, but I think that's  
something one can not avoid.

As I understand it that's what Kent Pitman is saying in the mail  
quoted previously, and I think that is right.

This is not the behaviour that CCL has: INVOKE-RESTART calls the test,  
regardless of whether you call it with a restart object, or a symbol  
naming one.  I think that's wrong (though this is obviously just my  
opinion).

It seems to me that this issue is getting confused because, in some of  
the earlier examples posted here, what was being done was (INVOKE- 
RESTART <symbol-naming-restart>), and I think in that case (from  
above) that the test should be invoked, as the restart is looked up  
(in other words, if I just have a name, I don't have a restart yet).

However I have not followed this really carefully, or thought about it  
enough.

--tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20100622/8cea2553/attachment.htm>


More information about the Openmcl-devel mailing list