Applicative load
opens the file named string
for textual
input;
reads immutable objects from the file until the end of the file
is reached; evaluates those objects consecutively in the
created
environment. The result from applicative load
is inert.
Notice that if string
is a relative path it is looked in the
current
directory (whatever that means in your OS, normally the
directory
from which the interpreted was run or the directory where
the
interpreter executable lives). klisp doesn't track the directory
from which the current code was read, so there's in principle no
way
to load a file in the same directory as the currently
executing code
with a relative path. See find-required-filename
for a way to
look for a file in a number of directories.
SOURCE NOTE: load is enumerated in the Kernel report, but the
description is not there yet. This seems like a sane way to define
it, taking the description of get-module
that there is in the
report.
The one detail that I think is still open, is whether to
return #inert
(as is the case with klisp currently) or rather
return the value of
the last evaluation.
Other implementations:
Since Bronze Age lisp claims compatibility with Klisp, and since I think Oto is likely to read this and correct me if I'm wrong, I'm going to be lazy and, with apologies, assume that what is true with Klisp is true for Bronze Age.
In a quick search, I couldn't find docs or source for Klink's implementation of load, or even whether this function is implemented.
I don't comment (much) on icbink since it's only now that I'm trying to bring it up to standards compliance, so not much should be read into however things are working in it currently.
So please don't expect an extensive survey of the state of Kernel implementations; I just reviewed what I could easily get my hands on.
On 05/21/2014 05:05 PM, Estevo wrote:
[...]
Other implementations:
Since Bronze Age lisp claims compatibility with Klisp, and since I think
Oto is likely to read this and correct me if I'm wrong, I'm going to be
lazy and, with apologies, assume that what is true with Klisp is true
for Bronze Age.
I agree that load should return #inert and the loaded object should
be immutable. Bronze Age's violates both principles.
Concerning the return value, Bronze Age Lisp is not "robust." The
Kernel Report discusses somewhat similar problem of $and?. In analogy
to $and?, non-robust implementation of load (and also non-standard
$when and $unless) can (I think) evaluate the last form in the tail
context.
Concerning the immutability, Bronze Age Lisp does not make immutable
copy of $vau and $lambda source for performance reasons. That's why
I did not make immutable copy in load.
3 - Although the R-1RK, R*RS, and all Kernel implementations that I knowof spell the name as /*load*/, /if /the response to 2 is as proposedshould then be called /load*!*/
above, I strongly believe that this environment mutating applicative
I don't think that load is an environment mutating applicative. The
effect depends on what is in the file.