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

What is this RESTART kludge?

I agree with Alan Bawden that RESTART should not have a value-returning
subform, and that RESTART-FROM is silly.  It is probably also OK to
flush (RESTART NIL) and require a non-null block-name.

The principal use that I see for RESTART is to allow certain forms to
conveniently restart a function from the top, making use of the implicit
named block around each defun body.  For example, one might test whether
an argument is of the proper type or meets some other criterion and, if
not, signal the problem with CERROR, asking for a new argument.  If the
user returns one, it is nice to be able to fix the arg in question, then
restart the function.  This will not work if the code has changed the
value of other argument variables, but it works in most cases.

It is true that this could be done by changing the function's body into
a PROG and placing a tag at the start (not forgetting to add a RETURN in
the proper place), but this is a pain; I find that this is just enough
extra hassle to keep me from doing the right thing with a CERROR in some
cases.  Having RESTART around would cause me (and, I bet, other lazy
slobs) to write somewhat better code in these cases, and the RESTART is
more self-explanatory than the equivalent PROG/TAG/GO would be.  I don't
think this is blind gotophobia; on the other hand, if RESTART were
flushed, I could probably live with that.  I just think it's a nice
minor convenience and worth the small additional clutter.

By the way, are we converging toward the name TAGBODY?  I much prefer
PROGBODY for this use.

-- Scott