From: Clint Hyde
Subject: Condition handling Q
Date: 
Message-ID: <3h8dbo$f20@info-server.bbn.com>
#+Allegro-4.2

I'd like to either replace the default handlers for 

UNDEFINED-FUNCTION

or add another one, so that I can have the choice (not currently
present) of "setf the naughty symbol to be the function that same symbol
but from another package"

[yeah, that's a sloppy description, LispM users will, I hope, recognize
it as being what I remember as the "package-dwim" response]

the general question therefore is: how can I add another (or modify the
existing "setf the naughty symbol" restart, which then switches input
streams on me to a place where joe user can't easily get to, effectively
initial-lisp-listener) restart choice to the existing set, in ALL
processes, without somehow putting a restart-bind/case wrapper around
all my processes?

I can do this wrapper, but I'd rather be able to do this a different
way, if there is one...

what I am imagining is that the error class UNDEFINED-FUNCTION has a
method that somehow returns appropriate restarts, and I want to add an
additional choice to that list.

I could, of course, be totally ignorant of how restarts are defined,
created and located by (compute-restarts)...I know how to use them in
the ways specified by CLtL2, but that's not what I actually want to do.
I need this restart to be available absolutely everywhere, and that
includes places where I am NOT able to casually insert it with my own
additional ones, like initial-lisp-listener's process.

 -- clint
From: Barry Margolin
Subject: Re: Condition handling Q
Date: 
Message-ID: <3hcra5$8s@tools.near.net>
In article <··········@info-server.bbn.com> Clint Hyde <·····@bbn.com> writes:
>what I am imagining is that the error class UNDEFINED-FUNCTION has a
>method that somehow returns appropriate restarts, and I want to add an
>additional choice to that list.

No, restarts don't come from conditions.  They're established dynamically
by the caller of the program that might signal the condition.  They're like
fancy catch-tags (in fact, they're often implemented using the catch/throw
mechanism).

However, what you want to establish isn't a restart, but a handler.  The
system should automatically provide USE-VALUE and/or STORE-VALUE restarts
that substitute a supplied value for the missing one.  You just need a
handler that invokes this restart.

In Symbolics Lisp's condition system there was a list of global handlers,
which was searched if no bound handlers handled the condition.
Unfortunately, the Common Lisp condition system doesn't have anything like
this.  I don't know whether Allegro CL has such a thing.

The closest you can come in standard CL is setting *DEBUGGER-HOOK*.  This
function receives the condition as a parameter, so it can check whether
it's of type UNDEFINED-FUNCTION.  If so, it can invoke the restart instead
of entering the debugger.
-- 

Barry Margolin
BBN Internet Services Corp.
······@near.net