I'm using a utility file that contain alot of utility functions,
auxfns.lisp, where some of the Common Lisp functions are redefined using
'defun'. There is this one function called "Reduce" which gives me
a debugger prompt, telling me that I'm redefining a Common Lisp function
and ask me to type "continue" to accept this action. To solve the problem
would be just type in the "continue" as it asked and it'll finish loading
successfully.
Now I need to find a way to load that same file without it asking me
each time. Is there a special declaration or command that'll let me
do that? Please! I don't want to type "continue" again!
Thanks millions!
--
+-------------------------------------------------------------------------+
| Yuan-chi (Bill) Chiu. yc...@ucssun1.sdsu.edu. Amiga Enthusiast. |
|-------------------------------------------------------------------------|
| A process cannot be understood by stopping it. Understanding must move |
| with the flow of the process, must join it and flow with it. |
+-------------------------------------------------------------------------+
There is no portable way to disable such redefinition warnings/errors.
In fact, this kind of redefinition breaks portability of the entire
program. (See CLtL2, p 260.) The best solution would be to rename the
offending function or put it in a user-defined package.
However, the Lisp implementation you're using probably has a global
variable or function which controls what to do when redefining
built-in functions. For example, in Allegro CL 4.2, redefining a
built-in function causes a PACKAGE-LOCKED-ERROR. To get around the
error you could either unlock the package or write the appropriate
error handler. In any case, your workaround will depend on the Lisp
implementation you are using.
--
Len Charest, Jr.
JPL Artificial Intelligence Group
cha...@underdog.jpl.nasa.gov
"There's no need to fear...Underdog is here!"
Hello comp.lang.list,
I'm using a utility file that contain alot of utility functions,
auxfns.lisp, where some of the Common Lisp functions are redefined using
'defun'. There is this one function called "Reduce" which gives me
a debugger prompt, telling me that I'm redefining a Common Lisp function
and ask me to type "continue" to accept this action. To solve the problem
would be just type in the "continue" as it asked and it'll finish loading
successfully.
Now I need to find a way to load that same file without it asking me
each time. Is there a special declaration or command that'll let me
do that? Please! I don't want to type "continue" again!
Rename your function in auxfns.lisp. You do not want to change the
function definition of a standard CL function. Doing so is guaranteed
to give you future headaches.
-JB
--
Jeff Berger |USmail: Ryerson 256
ber...@cs.uchicago.edu | Artificial Intelligence Lab
PH: (312) 702-8584 | 1100 East 58th Street
FX: (312) 702-8487 | Chicago, IL 60637
I was under the impression that doing SETF on the SYMBOL-FUNCTION bypassed
any warnings. No?
In Mr. Chiu's case, he almost certainly didn't want to redefine the built-in
function, but either give it a different name or put it in a separate
package. But there *are* times when you want to redefine built-in functions.
For instance, I have a minor metering hack called WITH-FUNCTION-CALL-COUNT
that will run a body of code, counting how many times the specified functions
are called in the process. It replaces the function definitions by a simple
closure that increments a counter and then calls the original function. The
user should be able to specify built-in functions (assuming they aren't
inlined), and wouldn't want warnings. A similar example is Jeff Siskend's
Screamer package, which adds Prolog-like non-determinism to Lisp, but needs to
modify some built-in things to add additional bookkeeping.
- Marty
all this advice is worthy, but suppose all you have is a .FASL ? then
what? you HAVE TO accept the redefinition, which means something like
the Allegro PACKAGE-LOCKED attribute.
-- clint
I'm 90% sure that you are talking about the "auxfns.lisp" from Peter
Norvig's book. The reason he redefines "reduce" is to bring it up to the
ANSI standard, which means adding a :KEY keyword to the argumentlist.
So, if you are using a ANSI common lisp which already supports the
extended REDUCE, you can safely comment it out of your auxfns.lisp file.
If you ARE running a pre-ANSI common lisp which doesn't yet support :KEY
in reduce AND you are quite sure you need it, you can redefine it, but
remember that there's a tiny (in this case quite small, I think) that you
can get unexpected behaviour from your system, EVEN though your new
function theoretically only extends the functionality of REDUCE (this is
because your compiler is free to make ANY kind of funny assumptions about
built-in functions).
________________________________________________________________________
Espen J. Vestre, es...@coli.uni-sb.de
Universität des Saarlandes,
Computerlinguistik, Gebäude 17.2
Postfach 1150, tel. +49 (681) 302 4501
D-66041 SAARBRÜCKEN, Germany fax. +49 (681) 302 4351
> Now I need to find a way to load that same file without it asking me
> each time. Is there a special declaration or command that'll let me
> do that? Please! I don't want to type "continue" again!
>
> Rename your function in auxfns.lisp. You do not want to change the
> function definition of a standard CL function. Doing so is guaranteed
> to give you future headaches.
If you must rename a standard function, I'd define it an alternate
package. That way, the old function will still be there, but you can
use the "new" definition. It's still messy and could get you into
trouble, but it's less likely to confuse the system.
It's a bit like the advise for Smalltalk programmers: always redefine
a method in a _subclass_, but never in the original class.
--
Martin Rodgers