Why must 'require' be evaluated in a separate expression to use of the package
common-lisp, lisp
Solution
The following may be inaccurate in some details, but it is approximately like this:
There are four phases that the Lisp "engine" goes through: read time, macro expansion time, compile time, and run time.
Each top-level form is first read in completely. Reading, however, involves resolution of the respective symbols. Since ASDF is not yet loaded during read time of your `eval-when` form, the symbol `asdf:*central-registry*` cannot be resolved yet, and this produces the mentioned read error.
Problem
I have some lisp initialisation code: ``` (eval-when (:compile-toplevel :load-toplevel :execute) (require 'asdf)) (eval-when (:compile-toplevel :load-toplevel :execute) (push #p"c\:\\lisp\\clsql-4.0.4\\" asdf:*central-registry*)) ``` Why does that version compile, while this version: ``` (eval-when (:compile-toplevel :load-toplevel :execute) (require 'asdf) (push #p"c\:\\lisp\\clsql-4.0.4\\" asdf:*central-registry*)) ``` produces an error during compile-file in the 3rd line, with asdf an unrecognised package? I'm using ccl, and (require 'asdf) is documented as bringing in the built-in version of ASDF.