[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What is this RESTART kludge?

    Date: Wednesday, 29 September 1982  20:53-EDT
    From: Scott E. Fahlman <Fahlman at Cmu-20c>

    For use in error recovery, it is important to have the implicit BLOCK
    surround the body, but NOT the variable initializations.  Re-doing the
    inits is hardly ever what you want to do, not to mention the fact that
    this would tend to clobber any repairs the user has made to variable

Can you provide examples to back up the claim that "re-doing the inits is
hardly ever what you want to do"?  Suppose:

(defun foo (l &optional (y (1+ (car l))))
	(when (oddp (car l))
	  (cerror :bad-argument "Odd car: ~S" l)
	  (restart foo))

Can you really argue that it is wrong to recompute the value of Y in GENERAL if
it wasn't given by the caller and the list L has been given a new car?
(Granted you can probably construct an INSTANCE in which it is wrong to
recompute the value of Y.)

A good reason to make the restart redo the inits is that it would otherwise be
impossible for the programmer to ask for that behavior, whereas if he doesn't
want them redone he can always explicitly add a restart block around the body
of his defun.  Given that in general you are going to have to think about this
problem when you write a RESTART, I think it best to give the option of having
it either way by having the built in restart do something that would be
impossible to do otherwise.

[Actually I think this is also a fairly good argument against the whole restart
 kludge.  No matter what we do here people are going to be fooled into
 believing that RESTART is something that it isn't.]