-
Notifications
You must be signed in to change notification settings - Fork 0
/
chap-24.texi
1072 lines (747 loc) · 36.2 KB
/
chap-24.texi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
@node System Construction
@chapter System Construction
@menu
* System Construction Concepts::
* System Construction Dictionary::
@end menu
@node System Construction Concepts
@section System Construction Concepts
@menu
* Loading::
* Features::
@end menu
@node Loading
@subsection Loading
To @symbolref{load, SYM} a @term{file} is to treat its contents as @term{code}
and @term{execute} that @term{code}.
The @term{file} may contain @newterm{source code} or @newterm{compiled code}.
A @term{file} containing @term{source code} is called a @newterm{source file}.
@term{Loading} a @term{source file} is accomplished essentially
by sequentially @term{reading}@sub{2} the @term{forms} in the file,
@i{evaluating} each immediately after it is @term{read}.
A @term{file} containing @term{compiled code} is called a @newterm{compiled file}.
@term{Loading} a @term{compiled file} is similar to @term{loading} a @term{source file},
except that the @term{file} does not contain text but rather an
@term{implementation-dependent} representation of pre-digested @term{expressions}
created by the @term{compiler}. Often, a @term{compiled file} can be @term{loaded}
more quickly than a @term{source file}.
See @ref{Compilation}.
The way in which a @term{source file} is distinguished from a @term{compiled file}
is @term{implementation-dependent}.
@node Features
@subsection Features
A @newterm{feature} is an aspect or attribute
of @clisp{},
of the @term{implementation},
or of the @term{environment}.
A @term{feature} is identified by a @term{symbol}.
A @term{feature} is said to be @newterm{present} in a @term{Lisp image}
if and only if the @term{symbol} naming it is an @term{element} of the
@term{list} held by @thevariable{*features*},
which is called the @newterm{features list}.
@node Feature Expressions
@subsubsection Feature Expressions
Boolean combinations of @term{features}, called
@cindex feature expression
@dfn{feature expressions},
are used by the @f{#+} and @f{#-} @term{reader macros} in order to
direct conditional @term{reading} of @term{expressions} by the @term{Lisp reader}.
The rules for interpreting a @term{feature expression} are as follows:
@table @asis
@item @id{@term{feature}}
If a @term{symbol} naming a @term{feature} is used as a @term{feature expression},
the @term{feature expression} succeeds if that @term{feature} is @term{present};
otherwise it fails.
@item @id{@f{(not @param{feature-conditional})}}
A @t{not} @term{feature expression} succeeds
if its argument @param{feature-conditional} fails;
otherwise, it succeeds.
@item @id{@f{(and @starparam{feature-conditional})}}
An @t{and} @term{feature expression} succeeds
if all of its argument @param{feature-conditionals} succeed;
otherwise, it fails.
@item @id{@f{(or @starparam{feature-conditional})}}
An @t{or} @term{feature expression} succeeds
if any of its argument @param{feature-conditionals} succeed;
otherwise, it fails.
@end table
@node Examples of Feature Expressions
@subsubsection Examples of Feature Expressions
in @term{implementation} A, the @term{features} @f{spice} and @f{perq} are @term{present},
but the @term{feature} @f{lispm} is not @term{present};
in @term{implementation} B, the feature @f{lispm} is @term{present},
but the @term{features} @f{spice} and @f{perq} are
not @term{present};
and
in @term{implementation} C, none of the features @f{spice}, @tt{lispm}, or @f{perq} are
@term{present}.
@Thenextfigure{}@spc{}shows some sample @term{expressions}, and how they would be
@term{read}@sub{2} in these @term{implementations}.
@float Figure,fig24.1
@cartouche
@multitable{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}{xxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
@item @f{(cons #+spice "Spice" #-spice "Lispm" x)} @tab
@item @quad{} in @term{implementation} A @mat{@ldots{}} @tab @f{(CONS "Spice" X)}
@item @quad{} in @term{implementation} B @mat{@ldots{}} @tab @f{(CONS "Lispm" X)}
@item @quad{} in @term{implementation} C @mat{@ldots{}} @tab @f{(CONS "Lispm" X)}
@item @f{(cons #+spice "Spice" #+LispM "Lispm" x)} @tab
@item @quad{} in @term{implementation} A @mat{@ldots{}} @tab @f{(CONS "Spice" X)}
@item @quad{} in @term{implementation} B @mat{@ldots{}} @tab @f{(CONS "Lispm" X)}
@item @quad{} in @term{implementation} C @mat{@ldots{}} @tab @f{(CONS X)}
@item @f{(setq a '(1 2 #+perq 43 #+(not perq) 27))} @tab
@item @quad{} in @term{implementation} A @mat{@ldots{}} @tab @f{(SETQ A '(1 2 43))}
@item @quad{} in @term{implementation} B @mat{@ldots{}} @tab @f{(SETQ A '(1 2 27))}
@item @quad{} in @term{implementation} C @mat{@ldots{}} @tab @f{(SETQ A '(1 2 27))}
@item @f{(let ((a 3) #+(or spice lispm) (b 3)) (foo a))} @tab
@item @quad{} in @term{implementation} A @mat{@ldots{}} @tab @f{(LET ((A 3) (B 3)) (FOO A))}
@item @quad{} in @term{implementation} B @mat{@ldots{}} @tab @f{(LET ((A 3) (B 3)) (FOO A))}
@item @quad{} in @term{implementation} C @mat{@ldots{}} @tab @f{(LET ((A 3)) (FOO A))}
@item @f{(cons #+Lispm "#+Spice" #+Spice "foo" #-(or Lispm Spice) 7 x)} @tab
@item @quad{} in @term{implementation} A @mat{@ldots{}} @tab @f{(CONS "foo" X)}
@item @quad{} in @term{implementation} B @mat{@ldots{}} @tab @f{(CONS "#+Spice" X)}
@item @quad{} in @term{implementation} C @mat{@ldots{}} @tab @f{(CONS 7 X)}
@end multitable
@end cartouche
@caption{Features examples}
@end float
@node System Construction Dictionary
@section System Construction Dictionary
@menu
* compile-file::
* compile-file-pathname::
* load::
* with-compilation-unit::
* *features*::
* *compile-file-pathname*; *compile-file-truename*::
* *load-pathname*; *load-truename*::
* *compile-print*; *compile-verbose*::
* *load-print*; *load-verbose*::
* *modules*::
* provide; require::
@end menu
@node compile-file
@syindexanchor{compile-file, SYM}
@subsection compile-file (Function)
@cindex compile-file
@subsubheading Syntax:
@DefunWithValuesNewline{compile-file, input-file @keyparam{} @vtop{@hbox{output-file verbose} @hbox{print external-format}}, output-truename\, warnings-p\, failure-p}
@subsubheading Arguments and Values:
@param{input-file}---a @term{pathname designator}.
(Default fillers for unspecified components are taken from
@symbolref{*default-pathname-defaults*, SYM}.)
@param{output-file}---a @term{pathname designator}.
@Default{@term{implementation-defined}}
@param{verbose}---a @term{generalized boolean}.
@Default{@thevalueof{*compile-verbose*}}
@param{print}---a @term{generalized boolean}.
@Default{@thevalueof{*compile-print*}}
@param{external-format}---an @term{external file format designator}.
@Default{@kwd{default}}
@param{output-truename}---a @term{pathname} (the @symbolref{truename, SYM} of the output @term{file}),
or @nil{}.
@param{warnings-p}---a @term{generalized boolean}.
@param{failure-p}---a @term{generalized boolean}.
@subsubheading Description:
@symbolref{compile-file, SYM} transforms the contents of the file specified
by @param{input-file} into @term{implementation-dependent} binary data
which are placed in the file specified by @param{output-file}.
The @term{file} to which @param{input-file} refers should be a @term{source file}.
@param{output-file} can be used to specify an output @term{pathname};
the actual @term{pathname} of the @term{compiled file}
to which @term{compiled code} will be output
is computed as if by calling @symbolref{compile-file-pathname, SYM}.
If @param{input-file} or @param{output-file} is a @term{logical pathname},
it is translated into a @term{physical pathname} as if by calling
@symbolref{translate-logical-pathname, SYM}.
If @param{verbose} is @term{true},
@symbolref{compile-file, SYM} prints a message in the form of a comment
(@ie{} with a leading @term{semicolon})
to @term{standard output} indicating what @term{file} is being @term{compiled}
and other useful information.
If @param{verbose} is @term{false},
@symbolref{compile-file, SYM} does not print
this information.
If @param{print} is @term{true},
information about @term{top level forms} in the file being
compiled is printed to @term{standard output}.
Exactly what is printed is @term{implementation-dependent},
but nevertheless some information is printed.
If @param{print} is @nil{}, no information is printed.
The @param{external-format} specifies the @term{external file format}
to be used when opening the @term{file}; see the @term{function} @ref{open}.
@symbolref{compile-file, SYM} and @symbolref{load, SYM} must cooperate in such a way that
the resulting @term{compiled file} can be @term{loaded}
without specifying an @term{external file format} anew; see the @term{function} @ref{load}.
@symbolref{compile-file, SYM} binds @symbolref{*readtable*, SYM} and @symbolref{*package*, SYM}
to the values they held before processing the file.
@symbolref{*compile-file-truename*, SYM} is bound by @symbolref{compile-file, SYM}
to hold the @term{truename} of the @term{pathname} of the file being compiled.
@symbolref{*compile-file-pathname*, SYM} is bound by @symbolref{compile-file, SYM}
to hold a @term{pathname} denoted by the first argument to @symbolref{compile-file, SYM},
merged against the defaults;
that is, @f{(pathname (merge-pathnames @param{input-file}))}.
The compiled @term{functions} contained in the @term{compiled file} become available
for use when the @term{compiled file} is @term{loaded} into Lisp.
Any function definition that is processed by the
compiler, including @f{#'(lambda ...)} forms and local function
definitions made by @symbolref{flet, SYM}, @symbolref{labels, SYM} and @symbolref{defun, SYM} forms,
result in an @term{object} @oftype{compiled-function}.
The @term{primary value} returned by @symbolref{compile-file, SYM}, @param{output-truename},
is the @symbolref{truename, SYM} of the output file, or @nil{}@spc{}if the file could not be created.
The @term{secondary value}, @param{warnings-p}, is @term{false}
if no @term{conditions} @oftype{error} or @symbolref{warning, SYM}
were detected by the compiler, and @term{true} otherwise.
The @term{tertiary value}, @param{failure-p}, is @term{false}
if no @term{conditions} @oftype{error} or @symbolref{warning, SYM}
(other than @symbolref{style-warning, SYM})
were detected by the compiler, and @term{true} otherwise.
For general information about how @term{files} are processed by the @term{file compiler},
see @ref{File Compilation}.
@term{Programs} to be compiled by the @term{file compiler} must only contain
@term{externalizable objects}; for details on such @term{objects},
see @ref{Literal Objects in Compiled Files}.
For information on how to extend the set of @term{externalizable objects},
see the @term{function} @ref{Additional Constraints on Externalizable Objects}.
@subsubheading Affected By:
@symbolref{*error-output*, SYM},
@symbolref{*standard-output*, SYM}, @symbolref{*compile-verbose*, SYM}, @symbolref{*compile-print*, SYM}
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 @oftype{file-error} might be signaled if
@tt{(wild-pathname-p @param{input-file})} returns true.
If either the attempt to open the @term{source file} for input
or the attempt to open the @term{compiled file} for output
fails,
an error @oftype{file-error} is signaled.
@subsubheading See Also:
@ref{compile},
@ref{declare},
@ref{eval-when},
@ref{pathname (System Class)},
@ref{logical-pathname (System Class)},
@ref{File System Concepts},
@ref{Pathnames as Filenames}
@node compile-file-pathname
@syindexanchor{compile-file-pathname, SYM}
@subsection compile-file-pathname (Function)
@cindex compile-file-pathname
@subsubheading Syntax:
@DefunWithValues{compile-file-pathname, input-file @keyparam{} output-file @allowotherkeys{}, pathname}
@subsubheading Arguments and Values:
@param{input-file}---a @term{pathname designator}.
(Default fillers for unspecified components are taken from
@symbolref{*default-pathname-defaults*, SYM}.)
@param{output-file}---a @term{pathname designator}.
@Default{@term{implementation-defined}}
@param{pathname}---a @term{pathname}.
@subsubheading Description:
Returns the @term{pathname} that @symbolref{compile-file, SYM} would write into,
if given the same arguments.
The defaults for the @param{output-file}
are taken from the @term{pathname}
that results from merging the @param{input-file}
with @thevalueof{*default-pathname-defaults*},
except that the type component
should default to the appropriate
@term{implementation-defined} default type for @term{compiled files}.
If @param{input-file} is a @term{logical pathname} and @param{output-file}
is unsupplied, the result is a @term{logical pathname}.
If @param{input-file} is a @term{logical pathname},
it is translated into a physical pathname as if by calling
@symbolref{translate-logical-pathname, SYM}.
If @param{input-file} is a @term{stream},
the @term{stream} can be either open or closed.
@symbolref{compile-file-pathname, SYM} returns the same @term{pathname} after a
file is closed as it did when the file was open.
It is an error if @param{input-file} is a @term{stream} that is
created with @symbolref{make-two-way-stream, SYM}, @symbolref{make-echo-stream, SYM},
@symbolref{make-broadcast-stream, SYM}, @symbolref{make-concatenated-stream, SYM},
@symbolref{make-string-input-stream, SYM}, @symbolref{make-string-output-stream, SYM}.
If an implementation supports additional keyword arguments to @symbolref{compile-file, SYM},
@symbolref{compile-file-pathname, SYM} must accept the same arguments.
@subsubheading Examples:
See @symbolref{logical-pathname-translations, SYM}.
@subsubheading Exceptional Situations:
An error @oftype{file-error} might be signaled if either @param{input-file} or
@param{output-file} is @term{wild}.
@subsubheading See Also:
@ref{compile-file},
@ref{pathname (System Class)},
@ref{logical-pathname (System Class)},
@ref{File System Concepts},
@ref{Pathnames as Filenames}
@node load
@syindexanchor{load, SYM}
@subsection load (Function)
@cindex load
@subsubheading Syntax:
@DefunWithValuesNewline{load, filespec @keyparam{} @vtop{@hbox{verbose print} @hbox{if-does-not-exist external-format}}, generalized-boolean}
@subsubheading Arguments and Values:
@param{filespec}---a @term{stream}, or a @term{pathname designator}.
@Default{taken from @symbolref{*default-pathname-defaults*, SYM}}
@param{verbose}---a @term{generalized boolean}.
@Default{@thevalueof{*load-verbose*}}
@param{print}---a @term{generalized boolean}.
@Default{@thevalueof{*load-print*}}
@param{if-does-not-exist}---a @term{generalized boolean}.
@Default{@term{true}}
@param{external-format}---an @term{external file format designator}.
@Default{@kwd{default}}
@param{generalized-boolean}---a @term{generalized boolean}.
@subsubheading Description:
@symbolref{load, SYM} @term{loads} the @term{file} named by @param{filespec}
into the @Lisp{}@spc{}environment.
The manner in which a @term{source file}
is distinguished from a @term{compiled file} is @term{implementation-dependent}.
If the file specification is not complete and both a @term{source file} and a
@term{compiled file} exist which might match,
then which of those files @symbolref{load, SYM} selects is @term{implementation-dependent}.
If @param{filespec} is a @term{stream},
@symbolref{load, SYM} determines what kind of @term{stream} it is
and loads directly from the @term{stream}.
If @param{filespec} is a @term{logical pathname},
it is translated into a @term{physical pathname}
as if by calling @symbolref{translate-logical-pathname, SYM}.
@symbolref{load, SYM} sequentially executes each @term{form} it encounters
in the @term{file} named by @param{filespec}.
If the @term{file} is a @term{source file}
and the @term{implementation} chooses to perform @term{implicit compilation},
@symbolref{load, SYM} must recognize @term{top level forms}
as described in @ref{Processing of Top Level Forms}
and arrange for each @term{top level form} to be executed
before beginning @term{implicit compilation} of the next.
(Note, however, that processing of @symbolref{eval-when, SYM} @term{forms}
by @symbolref{load, SYM} is controlled by the @kwd{execute} situation.)
If @param{verbose} is @term{true},
@symbolref{load, SYM} prints a message in the form of a comment
(@ie{} with a leading @term{semicolon})
to @term{standard output} indicating what @term{file} is being @term{loaded}
and other useful information.
If @param{verbose} is @term{false},
@symbolref{load, SYM} does not print this information.
If @param{print} is @term{true},
@symbolref{load, SYM} incrementally prints information to @term{standard output}
showing the progress of the @term{loading} process.
For a @term{source file},
this information might mean printing the @term{values}
@term{yielded} by each @term{form} in the @term{file}
as soon as those @term{values} are returned.
For a @term{compiled file},
what is printed might not reflect precisely the contents of the @term{source file},
but some information is generally printed.
If @param{print} is @term{false},
@symbolref{load, SYM} does not print this information.
If the file named by @param{filespec} is successfully loaded,
@symbolref{load, SYM} returns @term{true}.
@reviewer{Loosemore: What happens if the file cannot be loaded for some reason other
than that it doesn't exist?} @editornote{KMP: i.e., can it return NIL? must it?}
If the file does not exist,
the specific action taken depends on @param{if-does-not-exist}:
if it is @nil{}, @symbolref{load, SYM} returns @nil{};
otherwise, @symbolref{load, SYM} signals an error.
The @param{external-format} specifies the @term{external file format}
to be used when opening the @term{file} (see the @term{function} @ref{open}),
except that when the @term{file} named by @param{filespec} is a @term{compiled file},
the @param{external-format} is ignored.
@symbolref{compile-file, SYM} and @symbolref{load, SYM} cooperate
in an @term{implementation-dependent} way to assure
the preservation of the @term{similarity} of @term{characters}
referred to in the @term{source file}
at the time the @term{source file} was processed by the @term{file compiler}
under a given @term{external file format},
regardless of the value of @param{external-format}
at the time the @term{compiled file} is @term{loaded}.
@symbolref{load, SYM} binds @symbolref{*readtable*, SYM} and @symbolref{*package*, SYM}
to the values they held before @term{loading} the file.
@symbolref{*load-truename*, SYM} is @term{bound} by @symbolref{load, SYM} to hold
the @term{truename} of the @term{pathname} of the file being @term{loaded}.
@symbolref{*load-pathname*, SYM} is @term{bound} by @symbolref{load, SYM} to hold
a @term{pathname} that represents @param{filespec} merged against the defaults.
That is, @tt{(pathname (merge-pathnames @param{filespec}))}.
@subsubheading Examples:
@lisp
;Establish a data file...
(with-open-file (str "data.in" :direction :output :if-exists :error)
(print 1 str) (print '(setq a 888) str) t)
@EV{} T
(load "data.in") @EV{} @term{true}
a @EV{} 888
(load (setq p (merge-pathnames "data.in")) :verbose t)
; Loading contents of file /fred/data.in
; Finished loading /fred/data.in
@EV{} @term{true}
(load p :print t)
; Loading contents of file /fred/data.in
; 1
; 888
; Finished loading /fred/data.in
@EV{} @term{true}
@end lisp
@medbreak{}
@lisp
;----[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 lisp
@subsubheading Affected By:
The implementation, and the host computer's file system.
@subsubheading Exceptional Situations:
If @kwd{if-does-not-exist} is supplied and is @term{true}, or is not supplied,
@symbolref{load, SYM} signals an error @oftype{file-error} if the file named by
@param{filespec} does not exist,
or if the @term{file system} cannot perform the requested operation.
An error @oftype{file-error} might be signaled if
@f{(wild-pathname-p @param{filespec})} returns @term{true}.
@subsubheading See Also:
@ref{error (Function)},
@ref{merge-pathnames},
@ref{*load-verbose*},
@ref{*default-pathname-defaults*},
@ref{pathname (System Class)},
@ref{logical-pathname (System Class)},
@ref{File System Concepts},
@ref{Pathnames as Filenames}
@node with-compilation-unit
@syindexanchor{with-compilation-unit, SYM}
@subsection with-compilation-unit (Macro)
@cindex with-compilation-unit
@subsubheading Syntax:
@DefmacWithValues{with-compilation-unit, @paren{@interleave{@down{option}}} @starparam{form}, @starparam{result}}
@auxbnf{option, @kwd{override} override}
@subsubheading Arguments and Values:
@param{override}---a @term{generalized boolean}; @eval{}.
@Default{@nil{}}
@param{forms}---an @term{implicit progn}.
@param{results}---the @term{values} returned by the @term{forms}.
@subsubheading Description:
Executes @param{forms} from left to right.
Within the @term{dynamic environment} of @symbolref{with-compilation-unit, SYM},
actions deferred by the compiler until the end of compilation will be
deferred until the end of the outermost call to @symbolref{with-compilation-unit, SYM}.
The set of @i{options} permitted may be extended by the implementation,
but the only @term{standardized} keyword is @kwd{override}.
If nested dynamically only the outer call to
@symbolref{with-compilation-unit, SYM} has any effect unless the value
associated with @kwd{override} is @term{true}, in which case warnings are
deferred only to the end of the innermost call for which @param{override} is @term{true}.
The function @symbolref{compile-file, SYM}
provides the effect of
@lisp
(with-compilation-unit (:override nil) ...)
@end lisp
around its @term{code}.
Any @term{implementation-dependent} extensions can only be provided as the
result of an explicit programmer request by use of an
@term{implementation-dependent} keyword. @term{Implementations} are forbidden
from attaching additional meaning to a use of this macro which involves either
no keywords or just the keyword @kwd{override}.
@subsubheading Examples:
If an @term{implementation} would normally defer certain kinds of warnings,
such as warnings about undefined functions, to the end of a compilation
unit (such as a @term{file}), the following example shows how to cause those
warnings to be deferred to the end of the compilation of several files.
@lisp
(defun compile-files (&rest files)
(with-compilation-unit ()
(mapcar #'(lambda (file) (compile-file file)) files)))
(compile-files "A" "B" "C")
@end lisp
Note however that if the implementation does not normally defer any warnings,
use of @symbolref{with-compilation-unit, SYM} might not have any effect.
@subsubheading See Also:
@ref{compile}, @ref{compile-file}
@node *features*
@syindexanchor{*features*, SYM}
@subsection *features* (Variable)
@cindex *features*
@subsubheading Value Type:
a @term{proper list}.
@subsubheading Initial Value:
@term{implementation-dependent}.
@subsubheading Description:
@Thevalueof{*features*} is called the @term{features list}.
It is a @term{list} of @term{symbols}, called @term{features},
that correspond to some aspect of the @term{implementation} or @term{environment}.
Most @term{features} have @term{implementation-dependent} meanings;
The following meanings have been assigned to feature names:
@table @asis
@item @id{@kwd{cltl1}}
If present, indicates that the @code{LISP} @term{package} @term{purports to conform}
to the 1984 specification @CLtL{}.
It is possible, but not required, for a @term{conforming implementation}
to have this feature because this specification specifies that
its @term{symbols} are to be in the @code{COMMON-LISP} @term{package},
not the @code{LISP} package.
@item @id{@kwd{cltl2}}
If present, indicates that the implementation @term{purports to conform}
to @CLtLTwo{}.
This feature must not be present in any @term{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 @id{@kwd{ieee-floating-point}}
If present, indicates that the implementation @term{purports to conform}
to the requirements of @IEEEFloatingPoint{}.
@item @id{@kwd{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 @term{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 @kwd{draft-ansi-cl} and @kwd{ansi-cl} @term{features} prematurely.)
@item @id{@kwd{draft-ansi-cl}}
If present, indicates that the @term{implementation}
@term{purports to conform} to the first full draft of this specification,
which went to public review in 1992.
A @term{conforming implementation}
which has the @kwd{draft-ansi-cl-2} or @kwd{ansi-cl} @term{feature}
is not permitted to retain the @kwd{draft-ansi-cl} @term{feature}
since incompatible changes were made subsequent to the first draft.
@item @id{@kwd{draft-ansi-cl-2}}
If present, indicates that a second full draft of this specification
has gone to public review, and that the @term{implementation}
@term{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 @term{conforming implementation} which has the @kwd{ansi-cl}
@term{feature} is only permitted to retain the @kwd{draft-ansi-cl}
@term{feature} if the finally approved standard is not incompatible
with the draft standard.
@item @id{@kwd{ansi-cl}}
If present, indicates that this specification has been adopted by ANSI
as an official standard, and that the @term{implementation}
@term{purports to conform}.
@item @id{@kwd{common-lisp}}
This feature must appear in @symbolref{*features*, SYM} for any implementation that
has one or more of the features @kwd{x3j13}, @kwd{draft-ansi-cl},
or @kwd{ansi-cl}. It is intended that it should also appear in
implementations which have the features @kwd{cltl1} or @kwd{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:
@Thevalueof{*features*} is used by the @f{#+} and @f{#-} reader syntax.
@term{Symbols} in the @term{features list} may be in any @term{package},
but in practice they are generally in the @code{KEYWORD} @term{package}.
This is because @code{KEYWORD} is the @term{package} used by default
when @term{reading}@sub{2} @term{feature expressions}
in the @f{#+} and @f{#-} @term{reader macros}.
@term{Code} that needs to name a @term{feature}@sub{2} in a
@term{package} @mat{P} (other than @code{KEYWORD}) can do so
by making explicit use of a @term{package prefix} for @mat{P},
but note that such @term{code} must also assure that the @term{package} @mat{P}
exists in order for the @term{feature expression} to be @term{read}@sub{2}---even
in cases where the @term{feature expression} is expected to fail.
It is generally considered wise for an @term{implementation} to include
one or more @term{features} identifying the specific @term{implementation},
so that conditional expressions can be written which distinguish
idiosyncrasies of one @term{implementation} from those of another.
Since features are normally @term{symbols} in the @code{KEYWORD} @term{package}
where name collisions might easily result, and since no uniquely defined mechanism
is designated for deciding who has the right to use which @term{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 @term{implementation}.
@node *compile-file-pathname*; *compile-file-truename*
@syindexanchor{*compile-file-pathname*, SYM}
@syindexanchor{*compile-file-truename*, SYM}
@subsection *compile-file-pathname*, *compile-file-truename* (Variable)
@cindex *compile-file-pathname*
@cindex *compile-file-truename*
@subsubheading Value Type:
@Thevalueof{*compile-file-pathname*} must always be a @term{pathname} or @nil{}.
@Thevalueof{*compile-file-truename*} must always be a @term{physical pathname} or @nil{}.
@subsubheading Initial Value:
@nil{}.
@subsubheading Description:
During a call to @symbolref{compile-file, SYM},
@symbolref{*compile-file-pathname*, SYM} is @term{bound} to
the @term{pathname} denoted by the first argument to @symbolref{compile-file, SYM},
merged against the defaults;
that is, it is @term{bound} to @f{(pathname (merge-pathnames @param{input-file}))}.
During the same time interval,
@symbolref{*compile-file-truename*, SYM} is @term{bound} to
the @term{truename} of the @term{file} being @term{compiled}.
At other times, the @term{value} of these @term{variables} is @nil{}.
If a @term{break loop} is entered while @symbolref{compile-file, SYM} is ongoing,
it is @term{implementation-dependent} whether these @term{variables} retain
the @term{values} they had just prior to entering the @term{break loop}
or whether they are @term{bound} to @nil{}.
The consequences are unspecified if
an attempt is made to @term{assign} or @term{bind} either of these @term{variables}.
@subsubheading Affected By:
The @term{file system}.
@subsubheading See Also:
@ref{compile-file}
@node *load-pathname*; *load-truename*
@syindexanchor{*load-pathname*, SYM}
@syindexanchor{*load-truename*, SYM}
@subsection *load-pathname*, *load-truename* (Variable)
@cindex *load-pathname*
@cindex *load-truename*
@subsubheading Value Type:
@Thevalueof{*load-pathname*} must always be a @term{pathname} or @nil{}.
@Thevalueof{*load-truename*} must always be a @term{physical pathname} or @nil{}.
@subsubheading Initial Value:
@nil{}.
@subsubheading Description:
During a call to @symbolref{load, SYM},
@symbolref{*load-pathname*, SYM} is @term{bound} to
the @term{pathname} denoted by the the first argument to @symbolref{load, SYM},
merged against the defaults;
that is, it is @term{bound} to @f{(pathname (merge-pathnames @param{filespec}))}.
During the same time interval,
@symbolref{*load-truename*, SYM} is @term{bound} to
the @term{truename} of the @term{file} being loaded.
At other times, the @term{value} of these @term{variables} is @nil{}.
If a @term{break loop} is entered while @symbolref{load, SYM} is ongoing,
it is @term{implementation-dependent} whether these @term{variables} retain
the @term{values} they had just prior to entering the @term{break loop}
or whether they are @term{bound} to @nil{}.
The consequences are unspecified if
an attempt is made to @term{assign} or @term{bind} either of these @term{variables}.
@subsubheading Affected By:
The @term{file system}.
@subsubheading See Also:
@ref{load}
@node *compile-print*; *compile-verbose*
@syindexanchor{*compile-print*, SYM}
@syindexanchor{*compile-verbose*, SYM}
@subsection *compile-print*, *compile-verbose* (Variable)
@cindex *compile-verbose*
@cindex *compile-print*
@subsubheading Value Type:
a @term{generalized boolean}.
@subsubheading Initial Value:
@term{implementation-dependent}.
@subsubheading Description:
@Thevalueof{*compile-print*} is the default value of @thekeyarg{print}
to @symbolref{compile-file, SYM}.
@Thevalueof{*compile-verbose*} is the default value of @thekeyarg{verbose}
to @symbolref{compile-file, SYM}.
@subsubheading See Also:
@ref{compile-file}
@node *load-print*; *load-verbose*
@syindexanchor{*load-print*, SYM}
@syindexanchor{*load-verbose*, SYM}
@subsection *load-print*, *load-verbose* (Variable)
@cindex *load-verbose*
@cindex *load-print*
@anchor{*load-verbose*}
@subsubheading Value Type:
a @term{generalized boolean}.
@subsubheading Initial Value:
The initial @term{value} of @symbolref{*load-print*, SYM} is @term{false}.
The initial @term{value} of @symbolref{*load-verbose*, SYM} is @term{implementation-dependent}.
@subsubheading Description:
@Thevalueof{*load-print*} is the default value of @thekeyarg{print} to @symbolref{load, SYM}.
@Thevalueof{*load-verbose*} is the default value of @thekeyarg{verbose} to @symbolref{load, SYM}.
@subsubheading See Also:
@ref{load}
@node *modules*
@syindexanchor{*modules*, SYM}
@subsection *modules* (Variable)
@cindex *modules*
@subsubheading Value Type:
a @term{list} of @term{strings}.
@subsubheading Initial Value:
@term{implementation-dependent}.
@subsubheading Description:
@Thevalueof{*modules*} is a list of names of the modules
that have been loaded into the current @term{Lisp image}.
@subsubheading Affected By:
@symbolref{provide, SYM}
@subsubheading See Also:
@ref{provide},
@ref{require}
@subsubheading Notes:
The variable @symbolref{*modules*, SYM} is deprecated.
@node provide; require
@syindexanchor{provide, SYM}
@syindexanchor{require, SYM}
@subsection provide, require (Function)
@cindex require
@cindex provide
@anchor{provide}
@anchor{require}
@subsubheading Syntax:
@DefunWithValues{provide, module-name, @term{implementation-dependent}}
@DefunWithValues{require, module-name @opt{} pathname-list, @term{implementation-dependent}}
@subsubheading Arguments and Values:
@param{module-name}---a @term{@symbolnamedesignator{}}.
@param{pathname-list}---@nil{}, or
a @term{designator}
for a @term{non-empty} @term{list} of @term{pathname designators}.
@Default{@nil{}}
@subsubheading Description:
@symbolref{provide, SYM} adds the @param{module-name} to the @term{list} held by
@symbolref{*modules*, SYM}, if such a name is not already present.