[Ecls-list] Overwriting cl functions
Matthew Mondor
mm_lists at pulsar-zone.net
Tue Jan 29 14:22:16 UTC 2013
On Tue, 29 Jan 2013 15:07:19 +0100
Peter Enerccio <enerccio at gmail.com> wrote:
> Hello,
>
> I wanted to ask if it is possible to overwrite functions in common-lisp
> package.
> I know I can do it in c level, but I would rather do it in lisp level, if
> it is possible.
The part that allows to unlock/lock packages is
implementation-dependent, but that can be done on ECL using the
function EXT:PACKAGE-LOCK (the COMMON-LISP package is locked by
default). That said, it's also possible, and portable, to override a
COMMON-LISP package symbol in a specific package which USEs CL, like in
the following example, overriding GENTEMP in FOO:
(defpackage :foo
(:use :cl))
(shadow 'gentemp :foo)
(defun foo::gentemp (&rest args)
(error "Call to deprecated function GENTEMP with arguments ~S" args))
(in-package :foo)
(gentemp 4362642)
Condition of type: SIMPLE-ERROR
Call to deprecated function GENTEMP with arguments (4362642)
--
Matt
More information about the ecl-devel
mailing list