[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to eval. this code without a warning



    Date: Wed, 27 May 1992 16:29 PDT
    From: jbell@garnet.berkeley.edu (John E. Bell)

    I need to evaluate code such as the following without getting a warning
    about an undefined function appearing in the Listener:

     (let ()
	(load "foo.lisp")
	(bar))

    where bar is a function contained in the file foo.lisp. Bar is unbound before
    loading foo.lisp. How can I do it?

A general trick for fooling the reader/evaluator/compiler into
ignoring references to unresolved functions is to use FUNCALL and
INTERN:

(let ()
  (load "defines-bar-in-foo-package")
  (funcall (intern "BAR" "FOO")))

This is particularly useful for cases where the FOO package does not
exist at the time you define this form.  It stops the reader from
barfing when it sees FOO:BAR.