File: chap-24.texi

package info (click to toggle)
gclinfo 2.2-9
  • links: PTS
  • area: main
  • in suites: potato
  • size: 3,928 kB
  • ctags: 15
  • sloc: sed: 1,681; makefile: 127; lisp: 58; sh: 40
file content (1016 lines) | stat: -rw-r--r-- 35,259 bytes parent folder | download | duplicates (4)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016


@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