[comp.lang.lisp] Packages

barmar@think.COM (Barry Margolin) (12/16/87)

In article <464@cresswell.quintus.UUCP> pds@quintus.UUCP (Peter Schachte) writes:
>  Why do they put all SYMBOLS in
>packages?  It's much more natural to think of individual DEFINITIONS as
>being in packages.  That would make it much easier to move them around.

Because symbols are used for other things besides definitions.  For
example, property names are usually symbols.  It would be quite
possible for both a graphics program and a quantum mechanics program
to have properties name "COLOR".  If they are loaded into the same
environment (perhaps the graphics program is being used to display
information from the QM program) some way must be provided to keep
them from colliding if they both try to specify the "color" of the
same object; the package system does just this.

Yes, in many cases it would be simpler if it were just the definitions
that were in packages.  Scheme does this; they have replaced packages
with lexical environments (I don't remember the particular term they
use for this, though).  And instead of property lists, they recommend
the use of tables and association lists to prevent different programs
from colliding.  Personally, I like property lists a lot, as it is
really helpful during debugging to be able to look at the property
list of an object and see everything about it, rather than having to
find all the tables it could possibly be in (unfortunately, Symbolics
Lisp Machines also make extensive use of hash tables instead of
property lists).

---
Barry Margolin
Thinking Machines Corp.

barmar@think.com
seismo!think!barmar