
loadproc - loads an object on demand

Calling sequence:
loadproc(expr, string_1, string_2 [ , expr_1 ... ])

Parameter:
expr, expr_1         --  expressions
string_1, string_2   --  strings

Summary:

loadproc returns an element of a special loadproc-domain which reads in
a file if it is evaluated. This domain element usually is used to read an object
from file on demand. Thus objects are not read before they are used in order
to save memory space.

The following statement taken from the stdlib library file defines D to be an
element of the loadproc-domain:

    D:= loadproc(D, path, "D"):

If D is evaluated for the first time the file containing the \real" definition of D
is read and the element of the loadproc-domain is replaced by this definition.

Formally an element of the loadproc-domain, when evaluated, does the following:
It first tries to read a binary file given by string_1."BIN/".string_2.".mb".

If this file doesn't exist the text file string_1.string_2.".mu" is searched
for. These files are searched in the directories given by LIB_PATH .

The file read must contain the \real" definition of the object expr. After the
file is read expr is evaluated (now to its intended \real" value) and returned
as value of the evaluation of the element of the loadproc-domain.

Note that the first argument expr is not evaluated; the other arguments are
evaluated as usual.

Any alias definitions existing at the time the file is read are un-defined during
the read operation in order to avoid side-effects.  The alias definitions are
installed again after the file is read.

The optional arguments expr_1 ...  may be used to do some additional
computations after the file is read. When the additional arguments e1,e2,...,en
are given then the function call e1(e2,...,en) is evaluated after the file is
read. This may be used for example to change the object read in a certain
way after it is read.

One may cause the system to load ones own files instead of those in the
system library by defining a local library which contains the same directories
as the system library and the files to redefine. The root directory of the local
library must then be inserted into the LIB_PATH.

>>  random:= loadproc(random, pathname("STDLIB"), "random"):

See also:  alias , fread , loadlib , pathname

