From: <don...@is...> - 2009-02-26 22:21:44
|
Don Cohen writes: > Vladimir Tzankov writes: > > Many CL libraries will have similar issues (imagine inplace nreverse > > implementation being interrupted by timeout). > Clearly this is an example of something that should be abort protected. Just thought this might interest you: [1]> (setf *print-circle* t) T [2]> (setf l (list 1 2 3)) (1 2 3) [3]> (setf (cdr (last l)) l) #1=(1 2 3 . #1#) [4]> (nreverse l) #1=(2 . #1#) I was surprised that this finished. [5]> (reverse l) This hangs, so I try to interrupt it. ^C Signal 6 while exiting on a signal; cleanup may be incomplete Aborted [2009-02-26 14:08:43 root@number11 ~/clisp/build-dir] It seems clear to me that all such functions like nreverse or reverse that could take arbitrarily long ought to be interruptible. Of course, they should also use something like with-deferred-abort to warn the user that an abort will leave some data in an unexpected state. On the subject of the interpreter, I view this as similar to reverse in the sense that it's a limited amount of code, and should contain checks for interrupts at places that guarantee that it cannot ignore an interrupt request for very long. I'd think that the beginning of a form would be adequate. That would include (go ...). And in that case, perhaps it would not even need to defer aborts. |