1SBCL(1)                     General Commands Manual                    SBCL(1)
2
3
4

NAME

6       SBCL -- Steel Bank Common Lisp
7
8

DESCRIPTION

10       SBCL is an implementation of ANSI Common Lisp, featuring a high-perfor‐
11       mance native compiler, native threads on several  platforms,  a  socket
12       interface,  a  source-level  debugger, a statistical profiler, and much
13       more.
14
15       It is free software, mostly in the public domain, but with some subsys‐
16       tems  under  BSD-style  licenses  which allow modification and reuse as
17       long as credit is given. It is provided "as is", with  no  warranty  of
18       any kind.
19
20       For  more information about license issues, see the COPYING file in the
21       distribution. For more information about history, see the CREDITS  file
22       in the distribution.
23
24

RUNNING SBCL

26       To  run  SBCL,  type  "sbcl".  After  startup  messages  a prompt ("*")
27       appears. Enter a Lisp expression, and SBCL will read  and  execute  it,
28       print  any  values returned, give you another prompt, and wait for your
29       next input.
30
31
32         $ sbcl
33         ...[startup messages elided]...
34         * (+ 1 2 3)
35
36         6
37         * (quit)
38
39       Most people like to run SBCL as a subprocess  under  Emacs.  The  Emacs
40       "Slime" mode provides many convenient features, like command line edit‐
41       ing, tab completion, and various kinds of coupling between Common  Lisp
42       source files and the interactive SBCL subprocess.
43
44       For  information  on  creating "standalone executables" using SBCL, see
45       SB-EXT:SAVE-LISP-AND-DIE in the User Manual.
46
47

COMMAND LINE SYNTAX

49       For ordinary interactive use, no command line arguments should be  nec‐
50       essary.
51
52       In  order  to understand the SBCL command line syntax, it is helpful to
53       understand that the system is composed of two parts: a runtime environ‐
54       ment,  and  the Common Lisp system it supports. Some command line argu‐
55       ments are processed during the initialization of the runtime, and  some
56       during  the  initialization of the Lisp system -- any remaining command
57       line arguments are passed on to user code.
58
59       The overall command line syntax is:
60
61       sbcl  [runtime  options]   --end-runtime-options   [toplevel   options]
62       --end-toplevel-options [user options]
63
64       Both --end-runtime-options and --end-toplevel-options are optional, and
65       may be omitted. They are intended for use in situations where any  com‐
66       mand line options are under user control (eg. in batch files): by using
67       them you can prevent options intended for your program  being  acciden‐
68       tally processed by SBCL.
69
70       Supported runtime options are
71
72       --core <corefilename>
73          Use  the  specified  Lisp core file instead of the default. (See the
74          FILES section for the standard core, or the system documentation for
75          SB-EXT:SAVE-LISP-AND-DIE  for information about how to create a cus‐
76          tom core.) Note that if the Lisp core file is  a  user-created  core
77          file, it may run a nonstandard toplevel which does not recognize the
78          standard toplevel options.
79
80       --dynamic-space-size <megabytes>
81          Size of the dynamic space reserved on startup in megabytes.  Default
82          value is platform dependent.
83
84       --control-stack-size <megabytes>
85          Size of control stack reserved for each thread in megabytes. Default
86          value is 2.
87
88       --noinform
89          Suppress the printing of any banner or other  informational  message
90          at  startup. (This makes it easier to write Lisp programs which work
91          cleanly in Unix pipelines. See  also  the  "--noprint"  and  "--dis‐
92          able-debugger" options.)
93
94       --disable-ldb
95          Disable  the  low-level debugger. Only effective if SBCL is compiled
96          with LDB.
97
98       --lose-on-corruption
99          There are some dangerous low level  errors  (for  instance,  control
100          stack  exhausted, memory fault) that (or whose handlers) can corrupt
101          the image. By default SBCL prints a warning, then tries to  continue
102          and handle the error in Lisp, but this will not always work and SBCL
103          may malfunction or even hang. With this  option,  upon  encountering
104          such  an error SBCL will invoke ldb (if present and enabled) or else
105          exit.
106
107       --script <filename>
108          As  a  runtime  option  equivalent   to   --noinform   --disable-ldb
109          --lose-on-corruption --end-toplevel-options --script <filename>. See
110          the description of --script as a toplevel option below.
111
112       --help
113          Print some basic information about SBCL, then exit.
114
115       --version
116          Print SBCL's version information, then exit.
117
118       In the future, runtime options may be added to control behavior such as
119       lazy allocation of memory.
120
121       Runtime   options,  including  any  --end-runtime-options  option,  are
122       stripped out of the command line before the Lisp toplevel logic gets  a
123       chance to see it.
124
125       The toplevel options supported by the standard SBCL core are
126
127       --sysinit <filename>
128          Load  filename  instead  of  the  default system-wide initialization
129          file.  (See the FILES section.)
130
131       --no-sysinit
132          Do not load a system-wide initialization file.  If  this  option  is
133          given, the --sysinit option is ignored.
134
135       --userinit <filename>
136          Load  filename instead of the default user initialization file. (See
137          the FILES section.)
138
139       --no-userinit
140          Do not load a user initialization file. If this option is given, the
141          --userinit option is ignored.
142
143       --eval <command>
144          After  executing  any  initialization  file, but before starting the
145          read-eval-print loop on standard input, read and evaluate  the  com‐
146          mand given. More than one --eval option can be used, and all will be
147          read and executed, in the order they appear on the command line.
148
149       --load <filename>
150          This is equivalent to --eval '(load "<filename>")'. The special syn‐
151          tax  is intended to reduce quoting headaches when invoking SBCL from
152          shell scripts.
153
154       --noprint
155          When ordinarily the toplevel "read-eval-print loop"  would  be  exe‐
156          cuted, execute a "read-eval loop" instead, i.e. don't print a prompt
157          and don't echo results. Combined with the --noinform runtime option,
158          this  makes  it easier to write Lisp "scripts" which work cleanly in
159          Unix pipelines.
160
161       --disable-debugger
162          By default when SBCL encounters an  error,  it  enters  the  builtin
163          debugger,  allowing interactive diagnosis and possible intercession.
164          This option disables the debugger, causing errors to print  a  back‐
165          trace and exit with status 1 instead -- which is a mode of operation
166          better  suited  for  batch  processing.  See  the  User  Manual   on
167          SB-EXT:DISABLE-DEBUGGER for details.
168
169       --script <filename>
170          Implies      --no-sysinit      --no-userinit      --disable-debugger
171          --end-toplevel-options.
172
173          Causes the system to load the specified file  and  exit  immediately
174          afterwards,  instead  of  entering the readl-eval-print loop. If the
175          file begins with a shebang line, it is ignored.
176
177       Regardless of the order in which toplevel options appear on the command
178       line, the order of actions is:
179
180
181       1. Debugger is disabled, if requested.
182
183       2. Any system initialization file is loaded, unless prohibited.
184
185       3. Any user initialization file is loaded, unless prohibited.
186
187       4. --eval and --load options are processed in the order given.
188
189       Finally,  either the read-eval-print loop is entered or the file speci‐
190       fied with --script option is loaded.
191
192       When running in the read-eval-print loop the system  exits  on  end  of
193       file. Similarly, the system exits immediately after processing the file
194       specified with --script.
195
196       Note that when running SBCL with the --core option, using a  core  file
197       created  by  a  user call to the SB-EXT:SAVE-LISP-AND-DIE, the toplevel
198       options may be under the control of user code passed  as  arguments  to
199       SB-EXT:SAVE-LISP-AND-DIE.  For this purpose, the --end-toplevel-options
200       option itself can be considered a toplevel option, i.e. the user  core,
201       at its option, may not support it.
202
203       In the standard SBCL startup sequence (i.e. with no user core involved)
204       toplevel options and any --end-toplevel-options option are stripped out
205       of the command line argument list before user code gets a chance to see
206       it.
207
208

OVERVIEW

210       SBCL is derived from the CMU CL. (The name is intended  to  acknowledge
211       the connection: steel and banking are the industries where Carnegie and
212       Mellon made the big bucks.)
213
214       SBCL compiles by default: even functions entered in the read-eval-print
215       loop are compiled to native code, unless the evaluator has been explic‐
216       itly turned on. (Even today, some 30 years after the MacLisp  compiler,
217       people  will  tell  you  that  Lisp  is an interpreted language. Ignore
218       them.)
219
220       SBCL aims for but has not completely achieved compliance with the  ANSI
221       standard  for  Common Lisp. More information about this is available in
222       the BUGS section below.
223
224       SBCL also includes various non-ANSI extensions, described more fully in
225       the  User  Manual.  Some of these are in the base system and others are
226       "contrib" modules loaded on request using  REQUIRE.   For  example,  to
227       load the SB-BSD-SOCKETS module that provides TCP/IP connectivity,
228          * (require 'asdf)
229          * (require 'sb-bsd-sockets)
230
231       For more information, see the User Manual.
232

THE COMPILER

234       SBCL inherits from CMU CL the "Python" native code compiler. (Though we
235       often avoid that name in order to avoid confusion  with  the  scripting
236       language also called Python.) This compiler is very clever about under‐
237       standing the type system of Common Lisp and using it to optimize  code,
238       and  about  producing  notes  to  let  the  user know when the compiler
239       doesn't have enough type information to produce efficient code. It also
240       tries  (almost always successfully) to follow the unusual but very use‐
241       ful principle that "declarations are assertions", i.e.   type  declara‐
242       tions should be checked at runtime unless the user explicitly tells the
243       system that speed is more important than safety.
244
245       The compiled code uses garbage collection to automatically manage  mem‐
246       ory.  The garbage collector implementation varies considerably from CPU
247       to CPU. In particular, on some CPUs the GC is nearly  exact,  while  on
248       others it's more conservative, and on some CPUs the GC is generational,
249       while on others simpler stop and copy strategies are used.
250
251       For more information about the compiler, see the user manual.
252
253

SYSTEM REQUIREMENTS

255       SBCL currently runs on  X86  (Linux,  FreeBSD,  OpenBSD,  and  NetBSD),
256       X86-64  (Linux),  Alpha  (Linux,  Tru64),  PPC (Linux, Darwin/MacOS X),
257       SPARC (Linux and Solaris 2.x), and MIPS  (Linux).  For  information  on
258       other  ongoing  and  possible  ports,  see the sbcl-devel mailing list,
259       and/or the web site.
260
261       SBCL requires on the order of 16Mb RAM to run on  X86  systems,  though
262       all but the smallest programs would be happier with 32Mb or more.
263
264

KNOWN BUGS

266       This  section attempts to list the most serious and long-standing bugs.
267       For more detailed and current information on bugs, see the BUGS file in
268       the distribution.
269
270       It  is  possible to get in deep trouble by exhausting heap memory.  The
271       SBCL system overcommits memory at startup, so, on  typical  Unix-alikes
272       like Linux and FreeBSD, this means that if the SBCL system turns out to
273       use more virtual memory than the system has  available  for  it,  other
274       processes tend to be killed randomly (!).
275
276       The  compiler's  handling  of function return values unnecessarily vio‐
277       lates the "declarations are assertions"  principle  that  it  otherwise
278       adheres  to.  Using PROCLAIM or DECLAIM to specify the return type of a
279       function causes the compiler to believe you without checking. Thus com‐
280       piling a file containing
281         (DECLAIM (FTYPE (FUNCTION (T) NULL) SOMETIMES))
282         (DEFUN SOMETIMES (X) (ODDP X))
283         (DEFUN FOO (X) (IF (SOMETIMES X) 'THIS-TIME 'NOT-THIS-TIME))
284       then  running  (FOO 1) gives NOT-THIS-TIME, because the compiler relied
285       on the truth of the DECLAIM without checking it.
286
287       Some things are implemented very inefficiently.
288
289       -- Multidimensional arrays are inefficient, especially multidimensional
290          arrays of floating point numbers.
291
292       -- SBCL, like most (maybe all?) implementations of Common Lisp on stock
293          hardware, has trouble passing floating point  numbers  around  effi‐
294          ciently,  because  a floating point number, plus a few extra bits to
295          identify its type, is larger than a machine word.  (Thus,  they  get
296          "boxed"  in  heap-allocated  storage, causing GC overhead.) Within a
297          single compilation unit, or when doing built-in operations like SQRT
298          and  AREF,  or some special operations like structure slot accesses,
299          this is avoidable: see the user manual for  some  efficiency  hints.
300          But  for general function calls across the boundaries of compilation
301          units, passing the result of a floating point calculation as a func‐
302          tion  argument  (or  returning a floating point result as a function
303          value) is a fundamentally slow operation.
304

REPORTING BUGS

306       To report a bug, please send mail to the  mailing  lists  sbcl-help  or
307       sbcl-devel. You can find the complete mailing list addresses on the web
308       pages at <http://sbcl.sourceforge.net/>; note that as a spam  reduction
309       measure  you  must subscribe to the lists before you can post. (You may
310       also find fancy SourceForge bug-tracking machinery there, but don't  be
311       fooled. As of 2002-07-25 anyway, we don't actively monitor that machin‐
312       ery, and it exists only because we haven't been able to figure out  how
313       to turn it off.)
314
315       As  with  any software bug report, it's most helpful if you can provide
316       enough information to reproduce the symptoms reliably, and if  you  say
317       clearly  what  the symptoms are.  For example, "There seems to be some‐
318       thing wrong with TAN of very small negative arguments. When  I  execute
319       (TAN  LEAST-NEGATIVE-SINGLE-FLOAT)  interactively  on  sbcl-1.2.3 on my
320       Linux 4.5 X86 box, I get an UNBOUND-VARIABLE error."
321
322

DIFFERENCES FROM CMU CL

324       SBCL can be built from scratch using a plain vanilla ANSI  Common  Lisp
325       system and a C compiler, and all of its properties are specified by the
326       version of the source code that it was created from. This  clean  boot‐
327       strappability  was  the immediate motivation for forking off of the CMU
328       CL development tree. A variety of implementation differences are  moti‐
329       vated by this design goal.
330
331       Maintenance  work in SBCL since the fork has diverged somewhat from the
332       maintenance work in CMU CL. Many but not all bug fixes and improvements
333       have  been  shared  between  the  two  projects,  and sometimes the two
334       projects disagree about what would be an improvement.
335
336       Most extensions supported by CMU CL  have  been  unbundled  from  SBCL,
337       including  Motif  support,  the  Hemlock editor, search paths, the WIRE
338       protocol, various user-level macros and functions (e.g.  LETF, ITERATE,
339       MEMQ, REQUIRED-ARGUMENT), and many others.
340
341       (Why  doesn't SBCL support more extensions natively? Why drop all those
342       nice extensions from CMU CL when the code already  exists?  This  is  a
343       frequently  asked question on the mailing list. There are two principal
344       reasons. First, it's a design philosophy issue: arguably SBCL has  done
345       its  job by supplying a stable FFI, and the right design decision is to
346       move functionality derived from that, like socket support,  into  sepa‐
347       rate  libraries.  Some  of these are distributed with SBCL as "contrib"
348       modules, others are distributed as separate software packages by  sepa‐
349       rate  maintainers.  Second,  it's  a practical decision - focusing on a
350       smaller number of things will, we hope, let  us  do  a  better  job  on
351       them.)
352
353

SUPPORT

355       Various  information about SBCL is available at <http://www.sbcl.org/>.
356       The mailing lists there are the recommended place to look for support.
357
358

AUTHORS

360       Dozens of people have made substantial contributions to  SBCL  and  its
361       subsystems,  and  to  the CMU CL system on which it was based, over the
362       years. See the CREDITS file in the distribution for more information.
363
364

ENVIRONMENT

366       SBCL_HOME This   variable   controls   where   files   like   "sbclrc",
367                 "sbcl.core",  and  the  add-on "contrib" systems are searched
368                 for.  If it is not set, then sbcl sets it from a compile-time
369                 default  location  which  is usually /usr/local/lib/sbcl/ but
370                 may have been changed e.g. by a third-party packager.
371
372

FILES

374       sbcl   executable program containing some low-level runtime support and
375              a loader, used to read sbcl.core
376
377       sbcl.core
378              dumped memory image containing most of SBCL, to be loaded by the
379              `sbcl' executable.  Looked for in $SBCL_HOME, unless  overridden
380              by the --core option.
381
382       sbclrc optional    system-wide    startup   script,   looked   for   in
383              $SBCL_HOME/sbclrc then /etc/sbclrc,  unless  overridden  by  the
384              --sysinit command line option.
385
386       .sbclrc
387              optional  per-user  customizable  startup script (in user's home
388              directory, or as specified by  --userinit)
389
390

SEE ALSO

392       Full SBCL documentation is maintained as a Texinfo manual.  If  is  has
393       been installed, the command
394
395              info sbcl
396
397       should  give  you  access  to  the  complete  manual. Depending on your
398       installation it may also be available in HTML and PDF formats in eg.
399
400              /usr/local/share/doc/sbcl/
401
402       See the SBCL homepage
403
404              <http://www.sbcl.org/>
405
406       for more information, including directions on how to subscribe  to  the
407       sbcl-devel and sbcl-help mailing-lists.
408
409
410
4117th Edition              $Date: 2009/02/16 21:36:13 $                  SBCL(1)
Impressum