From: Sam Griffith
Subject: Eval & load
Date: 
Message-ID: <1992Feb18.231537.27525@pencom.com>
I need some help with understanding what load does when you ask it to load a  
file.  Also, do the load and eval commands get stripped out of an runtime image  
when you want to ship a product.  If so, how do you use just lisp code in a  
file as both the data and the program?

Sam Griffith
Pencom Software
···@pencom.com
From: Barry Margolin
Subject: Re: Eval & load
Date: 
Message-ID: <kqjib8INNe2q@early-bird.think.com>
In article <······················@pencom.com> ···@pencom.com writes:
>I need some help with understanding what load does when you ask it to load a  
>file.  

If you're loading a source file, it does something similar to:

(loop with eof = (cons nil nil)
      for form = (read file-stream nil eofr)
      until (eq form eof)
  do (eval form))

If you're loading a compiled file, the exact mechanism is
implementation-dependent.  The compiler puts a binary representation of the
intended effect of loading the file, and the loader then processes that
representation.  The compiled file generally includes the machine code for
all the function definitions, and the representation of the DEFUN forms is
some code that specifies that this machine code should be installed as the
definition of the function.

>	Also, do the load and eval commands get stripped out of an runtime image  
>when you want to ship a product.  If so, how do you use just lisp code in a  
>file as both the data and the program?

There is no standard mechanism for making runtime-only images (commonly
known as "tree shakers"), and you don't say what implementation you're
using.  In Lucid, the tree shaker has options that let you specify which
facilities should be kept.  I don't know about other implementations, but
I'd be surprised if they didn't provide this as well.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

······@think.com          {uunet,harvard}!think!barmar