Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#261 Function being inappropriately loaded

Stable_release
closed
nobody
None
1
2013-06-19
2013-06-08
lmj
No

foo.lisp:

(defun foo ()
  (bar))

(when (member 3 '(1 1 1))
  (defun bar ()
    (format t "bar!~%")))

FOO holds an invisible reference to BAR:

> (load (compile-file "foo.lisp"))

;;; Loading #P"/home/lmj/usr/stow/ecl-13.5.1/lib/ecl-13.5.1/cmp.fas"
;;;
;;; Compiling foo.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Compiling (DEFUN FOO ...).
;;; End of Pass 1.
;;; Emitting code for FOO.
;;; Emitting code for BAR.
;;; Finished compiling foo.lisp.
;;;
;;; Loading "/home/lmj/cur/bugs-ecl/foo.fas"
#P"/home/lmj/cur/bugs-ecl/foo.fas"
> (foo)
bar!
NIL
> (bar)

Condition of type: UNDEFINED-FUNCTION
The function BAR is undefined.

No problem loading foo.lisp directly without fasl.

Tested on Linux ecl-13.5.1 and ecl-12.12.1. (Latest build is broken, unbound C::+DEFAULT-MACHINE+.)

Discussion

  • Thanks for reporting. Currently DEFUN did not distinguish between toplevel forms and non-toplevel -- in toplevel forms ECL would be allowed to host a fixed reference to the BAR function.

    This is now fixed in git/CVS

     


Anonymous


Cancel   Add attachments