[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Date: Thu, 5 Apr 90 14:41 PDT
From: email@example.com (Larry Baum)
I have run into the following behavior which is annoying. We have a
system that we are maintaining for both Symbolics and Explorers, so we
(in-package (find-package 'tv) :nicknames '(w))
Now if this is loaded and we are working on something else and we write
code that references the TV package (e.g. (setq my-window
(tv:make-window ...) and then save and compile the file, the compiled
file references the "W" package. If we then try to load the compiled
file on a different machine or world where we haven't created the W
nickname, we get an error saying that W is an undefined package.
Keep in mind that nowhere in the source code is there a reference to W:,
i.e. this is just an undesired side effect of loading our system. Why
does the compiler change referneces to the TV package to refernces to
the W package?
As far as it's concerned, TV: and W: are completely equivalent, and the
shortest name for a package is used when outputting package prefixes (think
of how much disk space is saved in the Symbolics binaries due to the fact
that the package SYSTEM-INTERNALS is referred to by its nickname SI). The
prefix seen when reading in the file has nothing to do with it, since the
READ function doesn't return any indication of which package prefix was
seen when a symbol is read (READ is an information-losing operation).
Lisp write-read consistency requires that the package environment at write
time be the same as the package environment at read time, at least
regarding the packages and symbols written. You are violating this rule if
a package has a nickname at write time but not at read time.