[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
order of list returned by find-restarts
[I may have other comments later, but this caught my eye.]
Clinger> [re: FIND-RESTARTS] Is the list in any particular order?
I think it should be ordered from innermost to outermost. Not only is
this the natural way to construct it (pushing newest on front) but
there is good reason to think the dynamically innermost has the best
chance of being contextually appropriate and the dynamically outermost
the least. A simple example is command levels. If you do ABORT,
you'd like to find the first ABORT-handling restart in a list that
might include several and you'd like it to return you to the innermost
command level. Not that you won't sometimes want to return farther
out, but I think it's less common.
Actually, the command loop example may be clear but it may mistakenly
lead you to believe that it's natural for the loop to have data in it
saying its level. I'll pose another case that doesn't have this
property: you might have tried to open the file "foo.text" and not
found it only to find yourself in the debugger. then you might have
absentmindedly (or even intentionally, as part of an unrelated test)
tried to open "foo.text" again, without aborting, from the e debugger.
If you ask to use another file instead, I believe you mean for the
inner error, not the outer. If you receive restarts unordered, this
could get very confusing. And there is no obvious reason to suppose
that a "use this file instead" restart will have a "command level"
number naturally associated with to help you sort things out. I ALSO
believe that both the inner and outer restart should be accessible
because sometimes they are needed.
If you don't return the list in order, you should return the list with
enough information to order it. And since it seems silly to me to put
extra info in it as a sort key, I figure you might as well just return
an ordered list unless there is strong reason not to.