[Ecls-list] cannot redefine functions in compiled program?

Robert Dodier robert.dodier at gmail.com
Sun Dec 14 02:58:44 UTC 2008


Hi,

I am working with ECL as of about Dec 7.
it appears that when a function in a compiled program is redefined,
either in the interpreter or by compiling and loading a program,
function calls to any redefined functions go to the original
definition, not the new one.

e.g.

$ cat /tmp/foo.lisp
(defun f (x) (1+ (g x)))
(defun g (x) (/ x 2))

$ ecl
> (compile-file "/tmp/foo.lisp")
(... compiler messages suppressed ...)
#P"/tmp/foo.fas"
NIL
NIL
> (load "/tmp/foo")
;;; Loading #P"/tmp/foo.fas"
#P"/tmp/foo.fas"
> (g 11)
11/2
> (f 11)
13/2

OK so far. Now redefine G.

> (defun g (x) (/ x 3))
G
> (g 11)
11/3
> (f 11)
13/2

Hmm, I didn't expect 13/2, that uses the old version of G.
I expected 14/3. A call from the interpreter to G yields that:

> (1+ (g 11))
14/3


Is there a way to tell ECL that functions might be redefined?

It turns out this is fairly important for Maxima --- add-on libraries
commonly redefine functions in the compiled core program.

Thanks for any advice.

best

Robert Dodier




More information about the ecl-devel mailing list