[slime-devel] What's the difference between compile and load?

Gary King gwking at metabang.com
Thu Mar 1 13:08:27 UTC 2007

Hi and welcome,

On Mar 1, 2007, at 5:03 AM, E'Chao Zhang wrote:

> It makes me quite confused about the concept of compilation and  
> loading. Does the compilation of a file makes the definitions  
> inside the file accessible in the REPL?

No, it doesn't. The whole subject gets quite technical but compiling  
and loading are separate steps. The tricky thing is that both can  
happen in the same Lisp environment and the compiler may need to make  
some things active during the compilation process (e.g., macro  
definitions, constants, etc).

> Or do I have to load the file?

Yes, you will.

> If compilation is enough, then what's the loading for? If load is  
> mandatory, then why does compiling the defun makes the function  
> accessible?

If you're in the REPL and you "compile" a defun (or any s-expr), then  
you're really _evaluating_ it. Depending on the Lisp, this may  
produce a interpreted version of your defun or a compiled version  
(many Lisps nowawdays always compile and have no interpreter). This  
ends up being equivalent to compiling and loading but it, as I said,  
really evaluating...

Gary Warren King, metabang.com
Cell: (413) 885 9127
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM

More information about the slime-devel mailing list