[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
What does LOAD use for read table & package?
I think that the manual is silent on what readtable and package should
be used by load. Let's think about what the right thing would be.
It seems to me that, insofar as it is possible, we want to set things up
so that loading a compiled file has the same effect as loading the
source file. This says to me that if the source file uses In-Package to
specify the package to be used, the compiler should emit something in
the compiled-code file that makes this package current while the file is
being loaded. If the source file does not explicitly specify a package,
it should be loaded into whatever package is current when Load is
called.
(The "-*-" convention is not a part of Common Lisp and should not be
used by itself to set up packages in portable code. It is significant
to certain editors and other implementation-specific tools.)
In the case of loading uncompiled code files, the same thing would be
true: the in-package statement would govern, and if it is absent the
current package would be used by LOAD.
It would be nice to say the same thing for readtables -- use the current
one unless the file specifies otherwise -- but this is impractical.
Almost all of what a readtable does is done while the compiler is
reading the source file, at a time when the compiler has no way of
knowing what readtable will be current when the object file is loaded.
The loading of compiled code has little, if anything, to do with the
reader, so I think the question of whether to use the current or the
defautl readtable during such loads is moot.
So in the case of readtables, it comes down to a question of what Load
should do when loading uncompiled files. I'm inclined to think that the
current readtable should be used, even though this will have different
effects when loading a source file or the corresponding fasl file. We
should advise users that the readtable should be the way they want it at
COMPILE time if it is to effect code being compiled, because load time
is too late.
-- Scott