123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017 |
- @node System Construction, Environment, Reader, Top
- @chapter System Construction
- @menu
- * System Construction Concepts::
- * System Construction Dictionary::
- @end menu
- @node System Construction Concepts, System Construction Dictionary, System Construction, System Construction
- @section System Construction Concepts
- @c including concept-systems
- @menu
- * Loading::
- * Features::
- @end menu
- @node Loading, Features, System Construction Concepts, System Construction Concepts
- @subsection Loading
- To @b{load} a @i{file} is to treat its contents as @i{code}
- and @i{execute} that @i{code}.
- The @i{file} may contain @i{source code}
- @IGindex{source code}
- or @i{compiled code}
- @IGindex{compiled code}
- .
- A @i{file} containing @i{source code} is called a @i{source file}
- @IGindex{source file}
- .
- @i{Loading} a @i{source file} is accomplished essentially
- by sequentially @i{reading}_2 the @i{forms} in the file,
- @i{evaluating} each immediately after it is @i{read}.
- A @i{file} containing @i{compiled code} is called a @i{compiled file}
- @IGindex{compiled file}
- .
- @i{Loading} a @i{compiled file} is similar to @i{loading} a @i{source file},
- except that the @i{file} does not contain text but rather an
- @i{implementation-dependent} representation of pre-digested @i{expressions}
- created by the @i{compiler}. Often, a @i{compiled file} can be @i{loaded}
- more quickly than a @i{source file}.
- See @ref{Compilation}.
- The way in which a @i{source file} is distinguished from a @i{compiled file}
- is @i{implementation-dependent}.
- @node Features, , Loading, System Construction Concepts
- @subsection Features
- A @i{feature}
- @IGindex{feature}
- is an aspect or attribute
- of @r{Common Lisp},
- of the @i{implementation},
- or of the @i{environment}.
- A @i{feature} is identified by a @i{symbol}.
- A @i{feature} is said to be @i{present}
- @IGindex{present}
- in a @i{Lisp image}
- if and only if the @i{symbol} naming it is an @i{element} of the
- @i{list} held by the @i{variable} @b{*features*},
- which is called the @i{features list}
- @IGindex{features list}
- .
- @menu
- * Feature Expressions::
- * Examples of Feature Expressions::
- @end menu
- @node Feature Expressions, Examples of Feature Expressions, Features, Features
- @subsubsection Feature Expressions
- Boolean combinations of @i{features}, called @i{feature expressions}
- @IGindex{feature expression}
- ,
- are used by the @t{#+} and @t{#-} @i{reader macros} in order to
- direct conditional @i{reading} of @i{expressions} by the @i{Lisp reader}.
- The rules for interpreting a @i{feature expression} are as follows:
- @table @asis
- @item @i{feature}
- If a @i{symbol} naming a @i{feature} is used as a @i{feature expression},
- the @i{feature expression} succeeds if that @i{feature} is @i{present};
- otherwise it fails.
- @item @t{(not @i{feature-conditional})}
- A @b{not} @i{feature expression} succeeds
- if its argument @i{feature-conditional} fails;
- otherwise, it succeeds.
- @item @t{(and @{@i{feature-conditional}@}{*})}
- An @b{and} @i{feature expression} succeeds
- if all of its argument @i{feature-conditionals} succeed;
- otherwise, it fails.
- @item @t{(or @{@i{feature-conditional}@}{*})}
- An @b{or} @i{feature expression} succeeds
- if any of its argument @i{feature-conditionals} succeed;
- otherwise, it fails.
- @end table
- @node Examples of Feature Expressions, , Feature Expressions, Features
- @subsubsection Examples of Feature Expressions
- For example, suppose that
- in @i{implementation} A, the @i{features} @t{spice} and @t{perq} are @i{present},
- but the @i{feature} @t{lispm} is not @i{present};
- in @i{implementation} B, the feature @t{lispm} is @i{present},
- but the @i{features} @t{spice} and @t{perq} are
- not @i{present};
- and
- in @i{implementation} C, none of the features @t{spice}, @i{lispm}, or @t{perq} are
- @i{present}.
- Figure 24--1 shows some sample @i{expressions}, and how they would be
- @i{read}_2 in these @i{implementations}.
- @group
- @noindent
- @w{ @t{(cons #+spice "Spice" #-spice "Lispm" x)} }
- @w{ in @i{implementation} A ... @t{(CONS "Spice" X)} }
- @w{ in @i{implementation} B ... @t{(CONS "Lispm" X)} }
- @w{ in @i{implementation} C ... @t{(CONS "Lispm" X)} }
- @w{ @t{(cons #+spice "Spice" #+LispM "Lispm" x)} }
- @w{ in @i{implementation} A ... @t{(CONS "Spice" X)} }
- @w{ in @i{implementation} B ... @t{(CONS "Lispm" X)} }
- @w{ in @i{implementation} C ... @t{(CONS X)} }
- @w{ @t{(setq a '(1 2 #+perq 43 #+(not perq) 27))} }
- @w{ in @i{implementation} A ... @t{(SETQ A '(1 2 43))} }
- @w{ in @i{implementation} B ... @t{(SETQ A '(1 2 27))} }
- @w{ in @i{implementation} C ... @t{(SETQ A '(1 2 27))} }
- @w{ @t{(let ((a 3) #+(or spice lispm) (b 3)) (foo a))} }
- @w{ in @i{implementation} A ... @t{(LET ((A 3) (B 3)) (FOO A))} }
- @w{ in @i{implementation} B ... @t{(LET ((A 3) (B 3)) (FOO A))} }
- @w{ in @i{implementation} C ... @t{(LET ((A 3)) (FOO A))} }
- @w{ @t{(cons #+Lispm "#+Spice" #+Spice "foo" #-(or Lispm Spice) 7 x)} }
- @w{ in @i{implementation} A ... @t{(CONS "foo" X)} }
- @w{ in @i{implementation} B ... @t{(CONS "#+Spice" X)} }
- @w{ in @i{implementation} C ... @t{(CONS 7 X)} }
- @noindent
- @w{ Figure 24--1: Features examples }
- @end group
- @c end of including concept-systems
- @node System Construction Dictionary, , System Construction Concepts, System Construction
- @section System Construction Dictionary
- @c including dict-system-construction
- @menu
- * compile-file::
- * compile-file-pathname::
- * load::
- * with-compilation-unit::
- * *features*::
- * *compile-file-pathname*::
- * *load-pathname*::
- * *compile-print*::
- * *load-print*::
- * *modules*::
- * provide::
- @end menu
- @node compile-file, compile-file-pathname, System Construction Dictionary, System Construction Dictionary
- @subsection compile-file [Function]
- @code{compile-file} @i{input-file {&key} output-file verbose
- print external-format}@*
- @result{} @i{output-truename, warnings-p, failure-p}
- @subsubheading Arguments and Values::
- @i{input-file}---a @i{pathname designator}.
- (Default fillers for unspecified components are taken from
- @b{*default-pathname-defaults*}.)
- @i{output-file}---a @i{pathname designator}.
- The default is @i{implementation-defined}.
- @i{verbose}---a @i{generalized boolean}.
- The default is the @i{value} of @b{*compile-verbose*}.
- @i{print}---a @i{generalized boolean}.
- The default is the @i{value} of @b{*compile-print*}.
- @i{external-format}---an @i{external file format designator}.
- The default is @t{:default}.
- @i{output-truename}---a @i{pathname} (the @b{truename} of the output @i{file}),
- or @b{nil}.
- @i{warnings-p}---a @i{generalized boolean}.
- @i{failure-p}---a @i{generalized boolean}.
- @subsubheading Description::
- @b{compile-file} transforms the contents of the file specified
- by @i{input-file} into @i{implementation-dependent} binary data
- which are placed in the file specified by @i{output-file}.
- The @i{file} to which @i{input-file} refers should be a @i{source file}.
- @i{output-file} can be used to specify an output @i{pathname};
- the actual @i{pathname} of the @i{compiled file}
- to which @i{compiled code} will be output
- is computed as if by calling @b{compile-file-pathname}.
- If @i{input-file} or @i{output-file} is a @i{logical pathname},
- it is translated into a @i{physical pathname} as if by calling
- @b{translate-logical-pathname}.
- If @i{verbose} is @i{true},
- @b{compile-file} prints a message in the form of a comment
- (@i{i.e.}, with a leading @i{semicolon})
- to @i{standard output} indicating what @i{file} is being @i{compiled}
- and other useful information.
- If @i{verbose} is @i{false},
- @b{compile-file} does not print
- this information.
- If @i{print} is @i{true},
- information about @i{top level forms} in the file being
- compiled is printed to @i{standard output}.
- Exactly what is printed is @i{implementation-dependent},
- but nevertheless some information is printed.
- If @i{print} is @b{nil}, no information is printed.
- The @i{external-format} specifies the @i{external file format}
- to be used when opening the @i{file}; see the @i{function} @b{open}.
- @b{compile-file} and @b{load} must cooperate in such a way that
- the resulting @i{compiled file} can be @i{loaded}
- without specifying an @i{external file format} anew; see the @i{function} @b{load}.
- @b{compile-file} binds @b{*readtable*} and @b{*package*}
- to the values they held before processing the file.
- @b{*compile-file-truename*} is bound by @b{compile-file}
- to hold the @i{truename} of the @i{pathname} of the file being compiled.
- @b{*compile-file-pathname*} is bound by @b{compile-file}
- to hold a @i{pathname} denoted by the first argument to @b{compile-file},
- merged against the defaults;
- that is, @t{(pathname (merge-pathnames @i{input-file}))}.
- The compiled @i{functions} contained in the @i{compiled file} become available
- for use when the @i{compiled file} is @i{loaded} into Lisp.
- Any function definition that is processed by the
- compiler, including @t{#'(lambda ...)} forms and local function
- definitions made by @b{flet}, @b{labels} and @b{defun} forms,
- result in an @i{object} of @i{type} @b{compiled-function}.
- The @i{primary value} returned by @b{compile-file}, @i{output-truename},
- is the @b{truename} of the output file, or @b{nil} if the file could not be created.
- The @i{secondary value}, @i{warnings-p}, is @i{false}
- if no @i{conditions} of @i{type} @b{error} or @b{warning}
- were detected by the compiler, and @i{true} otherwise.
- The @i{tertiary value}, @i{failure-p}, is @i{false}
- if no @i{conditions} of @i{type} @b{error} or @b{warning}
- (other than @b{style-warning})
- were detected by the compiler, and @i{true} otherwise.
- For general information about how @i{files} are processed by the @i{file compiler},
- see @ref{File Compilation}.
- @i{Programs} to be compiled by the @i{file compiler} must only contain
- @i{externalizable objects}; for details on such @i{objects},
- see @ref{Literal Objects in Compiled Files}.
- For information on how to extend the set of @i{externalizable objects},
- see the @i{function} @b{make-load-form} and @ref{Additional Constraints on Externalizable Objects}.
- @subsubheading Affected By::
- @b{*error-output*},
- @b{*standard-output*}, @b{*compile-verbose*}, @b{*compile-print*}
- The computer's file system.
- @subsubheading Exceptional Situations::
- For information about errors detected during the compilation process,
- see @ref{Exceptional Situations in the Compiler}.
- An error of @i{type} @b{file-error} might be signaled if
- @t{(wild-pathname-p @i{input-file})\/} returns true.
- If either the attempt to open the @i{source file} for input
- or the attempt to open the @i{compiled file} for output
- fails,
- an error of @i{type} @b{file-error} is signaled.
- @subsubheading See Also::
- @ref{compile}
- ,
- @b{declare},
- @ref{eval-when}
- ,
- @b{pathname},
- @b{logical-pathname},
- @ref{File System Concepts},
- @ref{Pathnames as Filenames}
- @node compile-file-pathname, load, compile-file, System Construction Dictionary
- @subsection compile-file-pathname [Function]
- @code{compile-file-pathname} @i{input-file {&key} output-file {&allow-other-keys}} @result{} @i{pathname}
- @subsubheading Arguments and Values::
- @i{input-file}---a @i{pathname designator}.
- (Default fillers for unspecified components are taken from
- @b{*default-pathname-defaults*}.)
- @i{output-file}---a @i{pathname designator}.
- The default is @i{implementation-defined}.
- @i{pathname}---a @i{pathname}.
- @subsubheading Description::
- Returns the @i{pathname} that @b{compile-file} would write into,
- if given the same arguments.
- The defaults for the @i{output-file}
- are taken from the @i{pathname}
- that results from merging the @i{input-file}
- with the @i{value} of @b{*default-pathname-defaults*},
- except that the type component
- should default to the appropriate
- @i{implementation-defined} default type for @i{compiled files}.
- If @i{input-file} is a @i{logical pathname} and @i{output-file}
- is unsupplied, the result is a @i{logical pathname}.
- If @i{input-file} is a @i{logical pathname},
- it is translated into a physical pathname as if by calling
- @b{translate-logical-pathname}.
- If @i{input-file} is a @i{stream},
- the @i{stream} can be either open or closed.
- @b{compile-file-pathname} returns the same @i{pathname} after a
- file is closed as it did when the file was open.
- It is an error if @i{input-file} is a @i{stream} that is
- created with @b{make-two-way-stream}, @b{make-echo-stream},
- @b{make-broadcast-stream}, @b{make-concatenated-stream},
- @b{make-string-input-stream}, @b{make-string-output-stream}.
- If an implementation supports additional keyword arguments to @b{compile-file},
- @b{compile-file-pathname} must accept the same arguments.
- @subsubheading Examples::
- See @b{logical-pathname-translations}.
- @subsubheading Exceptional Situations::
- An error of @i{type} @b{file-error} might be signaled if either @i{input-file} or
- @i{output-file} is @i{wild}.
- @subsubheading See Also::
- @ref{compile-file}
- ,
- @b{pathname},
- @b{logical-pathname},
- @ref{File System Concepts},
- @ref{Pathnames as Filenames}
- @node load, with-compilation-unit, compile-file-pathname, System Construction Dictionary
- @subsection load [Function]
- @code{load} @i{filespec {&key} verbose print
- if-does-not-exist external-format}@*
- @result{} @i{generalized-boolean}
- @subsubheading Arguments and Values::
- @i{filespec}---a @i{stream}, or a @i{pathname designator}.
- The default is taken from @b{*default-pathname-defaults*}.
- @i{verbose}---a @i{generalized boolean}.
- The default is the @i{value} of @b{*load-verbose*}.
- @i{print}---a @i{generalized boolean}.
- The default is the @i{value} of @b{*load-print*}.
- @i{if-does-not-exist}---a @i{generalized boolean}.
- The default is @i{true}.
- @i{external-format}---an @i{external file format designator}.
- The default is @t{:default}.
- @i{generalized-boolean}---a @i{generalized boolean}.
- @subsubheading Description::
- @b{load} @i{loads} the @i{file} named by @i{filespec}
- into the @r{Lisp} environment.
- The manner in which a @i{source file}
- is distinguished from a @i{compiled file} is @i{implementation-dependent}.
- If the file specification is not complete and both a @i{source file} and a
- @i{compiled file} exist which might match,
- then which of those files @b{load} selects is @i{implementation-dependent}.
- If @i{filespec} is a @i{stream},
- @b{load} determines what kind of @i{stream} it is
- and loads directly from the @i{stream}.
- If @i{filespec} is a @i{logical pathname},
- it is translated into a @i{physical pathname}
- as if by calling @b{translate-logical-pathname}.
- @b{load} sequentially executes each @i{form} it encounters
- in the @i{file} named by @i{filespec}.
- If the @i{file} is a @i{source file}
- and the @i{implementation} chooses to perform @i{implicit compilation},
- @b{load} must recognize @i{top level forms}
- as described in @ref{Processing of Top Level Forms}
- and arrange for each @i{top level form} to be executed
- before beginning @i{implicit compilation} of the next.
- (Note, however, that processing of @b{eval-when} @i{forms}
- by @b{load} is controlled by the @t{:execute} situation.)
- If @i{verbose} is @i{true},
- @b{load} prints a message in the form of a comment
- (@i{i.e.}, with a leading @i{semicolon})
- to @i{standard output} indicating what @i{file} is being @i{loaded}
- and other useful information.
- If @i{verbose} is @i{false},
- @b{load} does not print this information.
- If @i{print} is @i{true},
- @b{load} incrementally prints information to @i{standard output}
- showing the progress of the @i{loading} process.
- For a @i{source file},
- this information might mean printing the @i{values}
- @i{yielded} by each @i{form} in the @i{file}
- as soon as those @i{values} are returned.
- For a @i{compiled file},
- what is printed might not reflect precisely the contents of the @i{source file},
- but some information is generally printed.
- If @i{print} is @i{false},
- @b{load} does not print this information.
- If the file named by @i{filespec} is successfully loaded,
- @b{load} returns @i{true}.
- [Reviewer Note by Loosemore: What happens if the file cannot be loaded for some reason other
- than that it doesn't exist?]
- [Editorial Note by KMP: i.e., can it return NIL? must it?]
- If the file does not exist,
- the specific action taken depends on @i{if-does-not-exist}:
- if it is @b{nil}, @b{load} returns @b{nil};
- otherwise, @b{load} signals an error.
- The @i{external-format} specifies the @i{external file format}
- to be used when opening the @i{file} (see the @i{function} @b{open}),
- except that when the @i{file} named by @i{filespec} is a @i{compiled file},
- the @i{external-format} is ignored.
- @b{compile-file} and @b{load} cooperate
- in an @i{implementation-dependent} way to assure
- the preservation of the @i{similarity} of @i{characters}
- referred to in the @i{source file}
- at the time the @i{source file} was processed by the @i{file compiler}
- under a given @i{external file format},
- regardless of the value of @i{external-format}
- at the time the @i{compiled file} is @i{loaded}.
- @b{load} binds @b{*readtable*} and @b{*package*}
- to the values they held before @i{loading} the file.
- @b{*load-truename*} is @i{bound} by @b{load} to hold
- the @i{truename} of the @i{pathname} of the file being @i{loaded}.
- @b{*load-pathname*} is @i{bound} by @b{load} to hold
- a @i{pathname} that represents @i{filespec} merged against the defaults.
- That is, @t{(pathname (merge-pathnames @i{filespec}))}.
- @subsubheading Examples::
- @example
- ;Establish a data file...
- (with-open-file (str "data.in" :direction :output :if-exists :error)
- (print 1 str) (print '(setq a 888) str) t)
- @result{} T
- (load "data.in") @result{} @i{true}
- a @result{} 888
- (load (setq p (merge-pathnames "data.in")) :verbose t)
- ; Loading contents of file /fred/data.in
- ; Finished loading /fred/data.in
- @result{} @i{true}
- (load p :print t)
- ; Loading contents of file /fred/data.in
- ; 1
- ; 888
- ; Finished loading /fred/data.in
- @result{} @i{true}
- @end example
- @example
- ;----[Begin file SETUP]----
- (in-package "MY-STUFF")
- (defmacro compile-truename () `',*compile-file-truename*)
- (defvar *my-compile-truename* (compile-truename) "Just for debugging.")
- (defvar *my-load-pathname* *load-pathname*)
- (defun load-my-system ()
- (dolist (module-name '("FOO" "BAR" "BAZ"))
- (load (merge-pathnames module-name *my-load-pathname*))))
- ;----[End of file SETUP]----
- (load "SETUP")
- (load-my-system)
- @end example
- @subsubheading Affected By::
- The implementation, and the host computer's file system.
- @subsubheading Exceptional Situations::
- If @t{:if-does-not-exist} is supplied and is @i{true}, or is not supplied,
- @b{load} signals an error of @i{type} @b{file-error} if the file named by
- @i{filespec} does not exist,
- or if the @i{file system} cannot perform the requested operation.
- An error of @i{type} @b{file-error} might be signaled if
- @t{(wild-pathname-p @i{filespec})} returns @i{true}.
- @subsubheading See Also::
- @ref{error}
- ,
- @ref{merge-pathnames}
- ,
- @b{*load-verbose*},
- @b{*default-pathname-defaults*},
- @b{pathname},
- @b{logical-pathname},
- @ref{File System Concepts},
- @ref{Pathnames as Filenames}
- @node with-compilation-unit, *features*, load, System Construction Dictionary
- @subsection with-compilation-unit [Macro]
- @code{with-compilation-unit} @i{@r{(}[[!@i{option}]]@r{)}
- @{@i{form}@}{*}} @result{} @i{@{@i{result}@}{*}}
- @w{@i{option} ::=@t{:override} override}
- @subsubheading Arguments and Values::
- @i{override}---a @i{generalized boolean}; evaluated.
- The default is @b{nil}.
- @i{forms}---an @i{implicit progn}.
- @i{results}---the @i{values} returned by the @i{forms}.
- @subsubheading Description::
- Executes @i{forms} from left to right.
- Within the @i{dynamic environment} of @b{with-compilation-unit},
- actions deferred by the compiler until the end of compilation will be
- deferred until the end of the outermost call to @b{with-compilation-unit}.
- The set of @i{options} permitted may be extended by the implementation,
- but the only @i{standardized} keyword is @t{:override}.
- If nested dynamically only the outer call to
- @b{with-compilation-unit} has any effect unless the value
- associated with @t{:override} is @i{true}, in which case warnings are
- deferred only to the end of the innermost call for which @i{override} is @i{true}.
- The function @b{compile-file}
- provides the effect of
- @example
- (with-compilation-unit (:override nil) ...)
- @end example
- around its @i{code}.
- Any @i{implementation-dependent} extensions can only be provided as the
- result of an explicit programmer request by use of an
- @i{implementation-dependent} keyword. @i{Implementations} are forbidden
- from attaching additional meaning to a use of this macro which involves either
- no keywords or just the keyword @t{:override}.
- @subsubheading Examples::
- If an @i{implementation} would normally defer certain kinds of warnings,
- such as warnings about undefined functions, to the end of a compilation
- unit (such as a @i{file}), the following example shows how to cause those
- warnings to be deferred to the end of the compilation of several files.
- @example
- (defun compile-files (&rest files)
- (with-compilation-unit ()
- (mapcar #'(lambda (file) (compile-file file)) files)))
- (compile-files "A" "B" "C")
- @end example
- Note however that if the implementation does not normally defer any warnings,
- use of @i{with-compilation-unit} might not have any effect.
- @subsubheading See Also::
- @ref{compile}
- ,
- @ref{compile-file}
- @node *features*, *compile-file-pathname*, with-compilation-unit, System Construction Dictionary
- @subsection *features* [Variable]
- @subsubheading Value Type::
- a @i{proper list}.
- @subsubheading Initial Value::
- @i{implementation-dependent}.
- @subsubheading Description::
- The @i{value} of @b{*features*} is called the @i{features list}.
- It is a @i{list} of @i{symbols}, called @i{features},
- that correspond to some aspect of the @i{implementation} or @i{environment}.
- Most @i{features} have @i{implementation-dependent} meanings;
- The following meanings have been assigned to feature names:
- @table @asis
- @item @t{:cltl1}
- If present, indicates that the @t{LISP} @i{package} @i{purports to conform}
- to the 1984 specification @i{Common Lisp: The Language}.
- It is possible, but not required, for a @i{conforming implementation}
- to have this feature because this specification specifies that
- its @i{symbols} are to be in the @t{COMMON-LISP} @i{package},
- not the @t{LISP} package.
- @item @t{:cltl2}
- If present, indicates that the implementation @i{purports to conform}
- to @i{Common Lisp: The Language, Second Edition}.
- This feature must not be present in any @i{conforming implementation},
- since conformance to that document is not compatible with conformance
- to this specification.
- The name, however, is reserved by this specification in order to help
- programs distinguish implementations which conform to that document
- from implementations which conform to this specification.
- @item @t{:ieee-floating-point}
- If present, indicates that the implementation @i{purports to conform}
- to the requirements of @i{IEEE Standard for Binary Floating-Point Arithmetic}.
- @item @t{:x3j13}
- If present, indicates that the implementation conforms to some
- particular working draft of this specification,
- or to some subset of features that approximates a belief about
- what this specification might turn out to contain.
- A @i{conforming implementation} might or might not contain
- such a feature.
- (This feature is intended primarily as a stopgap in order to
- provide implementors something to use prior to the availability
- of a draft standard, in order to discourage them from introducing
- the @t{:draft-ansi-cl} and @t{:ansi-cl} @i{features} prematurely.)
- @item @t{:draft-ansi-cl}
- If present, indicates that the @i{implementation}
- @i{purports to conform} to the first full draft of this specification,
- which went to public review in 1992.
- A @i{conforming implementation}
- which has the @t{:draft-ansi-cl-2} or @t{:ansi-cl} @i{feature}
- is not permitted to retain the @t{:draft-ansi-cl} @i{feature}
- since incompatible changes were made subsequent to the first draft.
- @item @t{:draft-ansi-cl-2}
- If present, indicates that a second full draft of this specification
- has gone to public review, and that the @i{implementation}
- @i{purports to conform} to that specification.
- (If additional public review drafts are produced, this keyword
- will continue to refer to the second draft, and additional keywords
- will be added to identify conformance with such later drafts.
- As such, the meaning of this keyword can be relied upon not to
- change over time.)
- A @i{conforming implementation} which has the @t{:ansi-cl}
- @i{feature} is only permitted to retain the @t{:draft-ansi-cl}
- @i{feature} if the finally approved standard is not incompatible
- with the draft standard.
- @item @t{:ansi-cl}
- If present, indicates that this specification has been adopted by ANSI
- as an official standard, and that the @i{implementation}
- @i{purports to conform}.
- @item @t{:common-lisp}
- This feature must appear in @b{*features*} for any implementation that
- has one or more of the features @t{:x3j13}, @t{:draft-ansi-cl},
- or @t{:ansi-cl}. It is intended that it should also appear in
- implementations which have the features @t{:cltl1} or @t{:cltl2},
- but this specification cannot force such behavior. The intent is
- that this feature should identify the language family named ``Common Lisp,''
- rather than some specific dialect within that family.
- @end table
- @subsubheading See Also::
- @ref{Use of Read-Time Conditionals},
- @ref{Standard Macro Characters}
- @subsubheading Notes::
- The @i{value} of @b{*features*} is used by the @t{#+} and @t{#-} reader syntax.
- @i{Symbols} in the @i{features list} may be in any @i{package},
- but in practice they are generally in the @t{KEYWORD} @i{package}.
- This is because @t{KEYWORD} is the @i{package} used by default
- when @i{reading}_2 @i{feature expressions}
- in the @t{#+} and @t{#-} @i{reader macros}.
- @i{Code} that needs to name a @i{feature}_2 in a
- @i{package} P (other than @t{KEYWORD}) can do so
- by making explicit use of a @i{package prefix} for P,
- but note that such @i{code} must also assure that the @i{package} P
- exists in order for the @i{feature expression} to be @i{read}_2---even
- in cases where the @i{feature expression} is expected to fail.
- It is generally considered wise for an @i{implementation} to include
- one or more @i{features} identifying the specific @i{implementation},
- so that conditional expressions can be written which distinguish
- idiosyncrasies of one @i{implementation} from those of another.
- Since features are normally @i{symbols} in the @t{KEYWORD} @i{package}
- where name collisions might easily result, and since no uniquely defined mechanism
- is designated for deciding who has the right to use which @i{symbol} for
- what reason, a conservative strategy is to prefer names derived from
- one's own company or product name, since those names are often trademarked
- and are hence less likely to be used unwittingly by another @i{implementation}.
- @node *compile-file-pathname*, *load-pathname*, *features*, System Construction Dictionary
- @subsection *compile-file-pathname*, *compile-file-truename* [Variable]
- @subsubheading Value Type::
- The @i{value} of @b{*compile-file-pathname*} must always be a @i{pathname} or @b{nil}.
- The @i{value} of @b{*compile-file-truename*} must always be a @i{physical pathname} or @b{nil}.
- @subsubheading Initial Value::
- @b{nil}.
- @subsubheading Description::
- During a call to @b{compile-file},
- @b{*compile-file-pathname*} is @i{bound} to
- the @i{pathname} denoted by the first argument to @b{compile-file},
- merged against the defaults;
- that is, it is @i{bound} to @t{(pathname (merge-pathnames @i{input-file}))}.
- During the same time interval,
- @b{*compile-file-truename*} is @i{bound} to
- the @i{truename} of the @i{file} being @i{compiled}.
- At other times, the @i{value} of these @i{variables} is @b{nil}.
- If a @i{break loop} is entered while @b{compile-file} is ongoing,
- it is @i{implementation-dependent} whether these @i{variables} retain
- the @i{values} they had just prior to entering the @i{break loop}
- or whether they are @i{bound} to @b{nil}.
- The consequences are unspecified if
- an attempt is made to @i{assign} or @i{bind} either of these @i{variables}.
- @subsubheading Affected By::
- The @i{file system}.
- @subsubheading See Also::
- @ref{compile-file}
- @node *load-pathname*, *compile-print*, *compile-file-pathname*, System Construction Dictionary
- @subsection *load-pathname*, *load-truename* [Variable]
- @subsubheading Value Type::
- The @i{value} of @b{*load-pathname*} must always be a @i{pathname} or @b{nil}.
- The @i{value} of @b{*load-truename*} must always be a @i{physical pathname} or @b{nil}.
- @subsubheading Initial Value::
- @b{nil}.
- @subsubheading Description::
- During a call to @b{load},
- @b{*load-pathname*} is @i{bound} to
- the @i{pathname} denoted by the the first argument to @b{load},
- merged against the defaults;
- that is, it is @i{bound} to @t{(pathname (merge-pathnames @i{filespec}))}.
- During the same time interval,
- @b{*load-truename*} is @i{bound} to
- the @i{truename} of the @i{file} being loaded.
- At other times, the @i{value} of these @i{variables} is @b{nil}.
- If a @i{break loop} is entered while @b{load} is ongoing,
- it is @i{implementation-dependent} whether these @i{variables} retain
- the @i{values} they had just prior to entering the @i{break loop}
- or whether they are @i{bound} to @b{nil}.
- The consequences are unspecified if
- an attempt is made to @i{assign} or @i{bind} either of these @i{variables}.
- @subsubheading Affected By::
- The @i{file system}.
- @subsubheading See Also::
- @ref{load}
- @node *compile-print*, *load-print*, *load-pathname*, System Construction Dictionary
- @subsection *compile-print*, *compile-verbose* [Variable]
- @subsubheading Value Type::
- a @i{generalized boolean}.
- @subsubheading Initial Value::
- @i{implementation-dependent}.
- @subsubheading Description::
- The @i{value} of @b{*compile-print*} is the default value of the @t{:print} @i{argument}
- to @b{compile-file}.
- The @i{value} of @b{*compile-verbose*} is the default value of the @t{:verbose} @i{argument}
- to @b{compile-file}.
- @subsubheading See Also::
- @ref{compile-file}
- @node *load-print*, *modules*, *compile-print*, System Construction Dictionary
- @subsection *load-print*, *load-verbose* [Variable]
- @subsubheading Value Type::
- a @i{generalized boolean}.
- @subsubheading Initial Value::
- The initial @i{value} of @b{*load-print*} is @i{false}.
- The initial @i{value} of @b{*load-verbose*} is @i{implementation-dependent}.
- @subsubheading Description::
- The @i{value} of @b{*load-print*} is the default value of the @t{:print} @i{argument} to @b{load}.
- The @i{value} of @b{*load-verbose*} is the default value of the @t{:verbose} @i{argument} to @b{load}.
- @subsubheading See Also::
- @ref{load}
- @node *modules*, provide, *load-print*, System Construction Dictionary
- @subsection *modules* [Variable]
- @subsubheading Value Type::
- a @i{list} of @i{strings}.
- @subsubheading Initial Value::
- @i{implementation-dependent}.
- @subsubheading Description::
- The @i{value} of @b{*modules*} is a list of names of the modules
- that have been loaded into the current @i{Lisp image}.
- @subsubheading Affected By::
- @b{provide}
- @subsubheading See Also::
- @ref{provide; require}
- ,
- @b{require}
- @subsubheading Notes::
- The variable @b{*modules*} is deprecated.
- @node provide, , *modules*, System Construction Dictionary
- @subsection provide, require [Function]
- @code{provide} @i{module-name} @result{} @i{@i{implementation-dependent}}
- @code{require} @i{module-name {&optional} pathname-list} @result{} @i{@i{implementation-dependent}}
- @subsubheading Arguments and Values::
- @i{module-name}---a @i{string designator}.
- @i{pathname-list}---@b{nil}, or
- a @i{designator}
- for a @i{non-empty} @i{list} of @i{pathname designators}.
- The default is @b{nil}.
- @subsubheading Description::
- @b{provide} adds the @i{module-name} to the @i{list} held by
- @b{*modules*}, if such a name is not already present.
- @b{require} tests for the presence of the @i{module-name} in the
- @i{list} held by @b{*modules*}.
- If it is present, @b{require} immediately returns.
- Otherwise, an attempt is made to load an appropriate set of @i{files} as follows:
- The @i{pathname-list} argument, if @i{non-nil},
- specifies a list of @i{pathnames} to be loaded in order, from left to right.
- If the @i{pathname-list} is @b{nil},
- an @i{implementation-dependent} mechanism will be invoked in an attempt
- to load the module named @i{module-name};
- if no such module can be loaded, an error of @i{type} @b{error} is signaled.
- Both functions use @b{string=} to test for the presence of a @i{module-name}.
- @subsubheading Examples::
- @example
- ;;; This illustrates a nonportable use of REQUIRE, because it
- ;;; depends on the implementation-dependent file-loading mechanism.
- (require "CALCULUS")
- ;;; This use of REQUIRE is nonportable because of the literal
- ;;; physical pathname.
- (require "CALCULUS" "/usr/lib/lisp/calculus")
- ;;; One form of portable usage involves supplying a logical pathname,
- ;;; with appropriate translations defined elsewhere.
- (require "CALCULUS" "lib:calculus")
- ;;; Another form of portable usage involves using a variable or
- ;;; table lookup function to determine the pathname, which again
- ;;; must be initialized elsewhere.
- (require "CALCULUS" *calculus-module-pathname*)
- @end example
- @subsubheading Side Effects::
- @b{provide} modifies @b{*modules*}.
- @subsubheading Affected By::
- The specific action taken by @b{require} is affected by calls to @b{provide}
- (or, in general, any changes to the @i{value} of @b{*modules*}).
- @subsubheading Exceptional Situations::
- Should signal an error of @i{type} @b{type-error}
- if @i{module-name} is not a @i{string designator}.
- If @b{require} fails to perform the requested operation
- due to a problem while interacting with the @i{file system},
- an error of @i{type} @b{file-error} is signaled.
- An error of @i{type} @b{file-error} might be signaled if any @i{pathname}
- in @i{pathname-list} is a @i{designator} for a @i{wild} @i{pathname}.
- @subsubheading See Also::
- @b{*modules*},
- @ref{Pathnames as Filenames}
- @subsubheading Notes::
- The functions @b{provide} and @b{require} are deprecated.
- If a module consists of a single @i{package},
- it is customary for the package and module names to be the same.
- @c end of including dict-system-construction
- @c %**end of chapter
|