SBCL Manual
SBCL Manual
Table of Contents
2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1 ANSI Conformance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Extensions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3 Idiosyncrasies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3.1 Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3.2 FASL Format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3.3 Compiler-only Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3.4 Defining Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3.5 Style Warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.4 Development Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.4.1 Editor Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.4.2 Language Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.4.3 Generating Executables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.5 More SBCL Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.5.1 SBCL Homepage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.5.2 Online Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.5.3 Additional Documentation Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.5.4 Internals Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.6 More Common Lisp Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.6.1 Internet Community . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.6.2 Third-party Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.6.3 Common Lisp Books . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.7 History and Implementation of SBCL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4 Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.1 Diagnostic Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.1.1 Controlling Verbosity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.1.2 Diagnostic Severity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.1.3 Understanding Compile Diagnostics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
ii
5 Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.1 Debugger Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.1.1 Debugger Banner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.1.2 Debugger Invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.2 Debugger Command Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.3 Stack Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.3.1 Stack Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.3.2 How Arguments are Printed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.3.3 Function Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.3.3.1 Entry Point Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.3.4 Debug Tail Recursion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.3.5 Unknown Locations and Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.4 Variable Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.4.1 Variable Value Availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.4.2 Note On Lexical Variable Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.5 Source Location Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.5.1 How the Source is Found . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.5.2 Source Location Availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5.6 Debugger Policy Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5.7 Exiting Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.8 Information Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.9 Function Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.10 Single Stepping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.11 Enabling and Disabling the Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6 Efficiency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.1 Slot access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.1.1 Structure object slot access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.1.2 Standard object slot access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.2 Dynamic-extent allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.3 Modular arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.4 Global and Always-Bound variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.5 Miscellaneous Efficiency Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
8 External Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
8.1 The Default External Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
8.2 External Format Designators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
8.3 Character Coding Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
8.4 Converting between Strings and Octet Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
8.5 Supported External Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
10 Pathnames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
10.1 Lisp Pathnames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
10.1.1 Home Directory Specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
10.1.2 The SYS Logical Pathname Host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
10.2 Native Filenames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
11 Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
11.1 Stream External Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
11.2 Bivalent Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
11.3 Gray Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
11.3.1 Gray Streams classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
11.3.2 Methods common to all streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
11.3.3 Input stream methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
11.3.4 Character input stream methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
11.3.5 Output stream methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
11.3.6 Character output stream methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
11.3.7 Binary stream methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
11.3.8 Gray Streams examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
11.3.8.1 Character counting input stream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
11.3.8.2 Output prefixing character stream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
11.4 Simple Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
12 Package Locks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.1 Package Lock Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.1.1 Package Locking Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.1.2 Implementation Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.1.3 Package Lock Violations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.1.3.1 Lexical Bindings and Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.1.3.2 Other Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.1.4 Package Locks in Compiled Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
12.1.4.1 Interned Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
12.1.4.2 Other Limitations on Compiled Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
12.1.5 Operations Violating Package Locks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
12.1.5.1 Operations on Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
12.1.5.2 Operations on Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
12.2 Package Lock Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
13 Threading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
13.1 Threading basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
13.1.1 Thread Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
13.1.2 Making, Returning From, Joining, and Yielding Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
13.1.3 Asynchronous Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
13.1.4 Miscellaneous Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
13.1.5 Error Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
13.2 Special Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
13.3 Atomic Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
CAS Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
13.4 Mutex Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
13.5 Semaphores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
13.6 Waitqueue/condition variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
v
14 Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
14.1 Timer Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
15 Networking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
15.1 Sockets Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
15.2 General Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
15.3 Socket Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
15.4 INET Domain Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
15.5 Local (Unix) Domain Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
15.6 Name Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
16 Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
16.1 Deterministic Profiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
16.2 Statistical Profiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
16.2.1 Example Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
16.2.2 Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
16.2.3 Platform support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
16.2.4 Macros. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
16.2.5 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
16.2.6 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
16.2.7 Credits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
18 Deprecation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
18.1 Why Deprecate? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
18.2 The Deprecation Pipeline. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
18.3 Deprecation Conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
18.4 Introspecting Deprecation Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
18.5 Deprecation Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
18.6 Deprecation Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
18.7 Deprecated Interfaces in SBCL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
18.7.1 List of Deprecated Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
18.7.1.1 Early Deprecation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
18.7.1.2 Late Deprecation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
18.7.1.3 Final Deprecation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
18.7.2 Historical Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Colophon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
1
2 Introduction
SBCL is a mostly-conforming implementation of the ANSI Common Lisp standard. This manual focuses
on behavior which is specific to SBCL, not on behavior which is common to all implementations of ANSI
Common Lisp.
2.2 Extensions
SBCL comes with numerous extensions, some in core and some in modules loadable with require. Unfor-
tunately, not all of these extensions have proper documentation yet.
System Definition Tool
asdf is a flexible and popular protocol-oriented system definition tool by Daniel Barlow. See
Info file asdf, node ‘Top’, for more information.
Foreign Function Interface
sb-alien package allows interfacing with C-code, loading shared object files, etc. See Chapter 9
[Foreign Function Interface], page 71.
sb-grovel can be used to partially automate generation of foreign function interface definitions.
See Section 17.4 [sb-grovel], page 129.
Recursive Event Loop
SBCL provides a recursive event loop (serve-event) for doing non-blocking IO on multiple
streams without using threads.
Timeouts and Deadlines
SBCL allows restricting the execution time of individual operations or parts of a computation
using :timeout arguments to certain blocking operations, synchronous timeouts and asyn-
chronous timeouts. The latter two affect operations without explicit timeout support (such as
standard functions and macros). See Section 7.14 [Timeouts and Deadlines], page 63.
Metaobject Protocol
sb-mop package provides a metaobject protocol for the Common Lisp Object System as de-
scribed in Art of Metaobject Protocol.
Extensible Sequences
SBCL allows users to define subclasses of the sequence class. See Section 7.6 [Extensible
Sequences], page 49.
Native Threads
SBCL has native threads on x86/Linux, capable of taking advantage of SMP on multiprocessor
machines. See Chapter 13 [Threading], page 95.
Network Interface
sb-bsd-sockets is a low-level networking interface, providing both TCP and UDP sockets.
See Chapter 15 [Networking], page 109.
Introspective Facilities
sb-introspect module offers numerous introspective extensions, including access to function
lambda-lists and a cross referencing facility.
Operating System Interface
sb-ext contains a number of functions for running external processes, accessing environment
variables, etc.
sb-posix module provides a lispy interface to standard POSIX facilities.
Extensible Streams
sb-gray is an implementation of Gray Streams. See Section 11.3 [Gray Streams], page 84.
sb-simple-streams is an implementation of the simple streams API proposed by Franz Inc.
See Section 11.4 [Simple Streams], page 90.
Chapter 2: Introduction 4
Profiling sb-profile is a exact per-function profiler. See Section 16.1 [Deterministic Profiler], page 113.
sb-sprof is a statistical profiler, capable of call-graph generation and instruction level profiling,
which also supports allocation profiling. See Section 16.2 [Statistical Profiler], page 113.
Customization Hooks
SBCL contains a number of extra-standard customization hooks that can be used to tweak the
behaviour of the system. See Section 7.9 [Customization Hooks for Users], page 59.
sb-aclrepl provides an Allegro CL -style toplevel for SBCL, as an alternative to the classic
CMUCL-style one. See Section 17.1 [sb-aclrepl], page 120.
CLTL2 Compatibility Layer
sb-cltl2 module provides compiler-let and environment access functionality described in
Common Lisp The Language, 2nd Edition which were removed from the language during the
ANSI standardization process.
Executable Delivery
The :executable argument to [Function sb-ext save-lisp-and-die], page 10, can produce a
‘standalone’ executable containing both an image of the current Lisp session and an SBCL
runtime.
Bitwise Rotation
sb-rotate-byte provides an efficient primitive for bitwise rotation of integers, an operation
required by e.g. numerous cryptographic algorithms, but not available as a primitive in ANSI
Common Lisp. See Section 17.8 [sb-rotate-byte], page 139.
Test Harness
sb-rt module is a simple yet attractive regression and unit-test framework.
MD5 Sums sb-md5 is an implementation of the MD5 message digest algorithm for Common Lisp, using
the modular arithmetic optimizations provided by SBCL. See Section 17.5 [sb-md5], page 132.
2.3 Idiosyncrasies
The information in this section describes some of the ways that SBCL deals with choices that the ANSI
standard leaves to the implementation.
2.3.1 Declarations
Declarations are generally treated as assertions. This general principle, and its implications, and the bugs
which still keep the compiler from quite satisfying this principle, are discussed in Section 4.2.1 [Declarations
as Assertions], page 19.
INSTALL Covers installing SBCL from both source and binary distributions on your system, and also
has some installation related troubleshooting information.
• The system is implemented as a C program which is responsible for supplying low-level services and
loading a Lisp .core file.
SBCL also inherited some newer architectural features from CMUCL. The most important is that on
some architectures it has a generational garbage collector (“GC”), which has various implications (mostly
good) for performance. These are discussed in another chapter, Chapter 6 [Efficiency], page 37.
SBCL has diverged from CMUCL in that SBCL is now essentially a “compiler-only implementation”
of Common Lisp. This is a change in implementation strategy, taking advantage of the freedom “any of
these facilities might share the same execution strategy” guaranteed in the ANSI specification section 3.1
(“Evaluation”). It does not mean SBCL can’t be used interactively, and in fact the change is largely invisible
to the casual user, since SBCL still can and does execute code interactively by compiling it on the fly. (It
is visible if you know how to look, like using compiled-function-p; and it is visible in the way that SBCL
doesn’t have many bugs which behave differently in interpreted code than in compiled code.) What it means
is that in SBCL, the eval function only truly “interprets” a few easy kinds of forms, such as symbols which
are boundp. More complicated forms are evaluated by calling compile and then calling funcall on the
returned result.
The direct ancestor of SBCL is the x86 port of CMUCL. This port was in some ways the most cobbled-
together of all the CMUCL ports, since a number of strange changes had to be made to support the
register-poor x86 architecture. Some things (like tracing and debugging) do not work particularly well there.
SBCL should be able to improve in these areas (and has already improved in some other areas), but it takes
a while.
On the x86 SBCL – like the x86 port of CMUCL – uses a conservative GC. This means that it doesn’t
maintain a strict separation between tagged and untagged data, instead treating some untagged data (e.g.
raw floating point numbers) as possibly-tagged data and so not collecting any Lisp objects that they point
to. This has some negative consequences for average time efficiency (though possibly no worse than the
negative consequences of trying to implement an exact GC on a processor architecture as register-poor as
the X86) and also has potentially unlimited consequences for worst-case memory efficiency. In practice,
conservative garbage collectors work reasonably well, not getting anywhere near the worst case. But they
can occasionally cause odd patterns of memory usage.
The fork from CMUCL was based on a major rewrite of the system bootstrap process. CMUCL has for
many years tolerated a very unusual “build” procedure which doesn’t actually build the complete system
from scratch, but instead progressively overwrites parts of a running system with new versions. This quasi-
build procedure can cause various bizarre bootstrapping hangups, especially when a major change is made
to the system. It also makes the connection between the current source code and the current executable
more tenuous than in other software systems – it’s easy to accidentally “build” a CMUCL system containing
characteristics not reflected in the current version of the source code.
Other major changes since the fork from CMUCL include
• SBCL has removed many CMUCL extensions, (e.g. IP networking, remote procedure call, Unix system
interface, and X11 interface) from the core system. Most of these are available as contributed modules
(distributed with SBCL) or third-party modules instead.
• SBCL has deleted or deprecated some nonstandard features and code complexity which helped efficiency
at the price of maintainability. For example, the SBCL compiler no longer implements memory pooling
internally (and so is simpler and more maintainable, but generates more garbage and runs more slowly),
and various block-compilation efficiency-increasing extensions to the language have been deleted or are
no longer used in the implementation of SBCL itself.
9
4
* (exit)
$
See also Section 3.3 [Command Line Options], page 12, and Section 3.2 [Stopping SBCL], page 9.
3.2.1 Exit
SBCL can be stopped at any time by calling sb-ext:exit, optionally returning a specified numeric value
to the calling process. See Chapter 13 [Threading], page 95, for information about terminating individual
threads.
sb-ext:exit &key code abort timeout [Function]
Terminates the process, causing sbcl to exit with code. code defaults to 0 when abort is false, and 1
when it is true.
When abort is false (the default), current thread is first unwound, *exit-hooks* are run, other threads
are terminated, and standard output streams are flushed before sbcl calls exit(3) -- at which point
atexit(3) functions will run. If multiple threads call exit with abort being false, the first one to call it
will complete the protocol.
Chapter 3: Starting and Stopping 10
When abort is true, sbcl exits immediately by calling exit(2) without unwinding stack, or calling exit
hooks. Note that exit(2) does not call atexit(3) functions unlike exit(3).
Recursive calls to exit cause exit to behave as if abort was true.
timeout controls waiting for other threads to terminate when abort is nil. Once current thread has been
unwound and *exit-hooks* have been run, spawning new threads is prevented and all other threads
are terminated by calling terminate-thread on them. The system then waits for them to finish using
join-thread, waiting at most a total timeout seconds for all threads to join. Those threads that do not
finish in time are simply ignored while the exit protocol continues. timeout defaults to *exit-timeout*,
which in turn defaults to 60. timeout nil means to wait indefinitely.
Note that timeout applies only to join-thread, not *exit-hooks*. Since terminate-thread is asyn-
chronous, getting multithreaded application termination with complex cleanups right using it can be
tricky. To perform an orderly synchronous shutdown use an exit hook instead of relying on implicit
thread termination.
Consequences are unspecified if serious conditions occur during exit excepting errors from *exit-hooks*,
which cause warnings and stop execution of the hook that signaled, but otherwise allow the exit process
to continue normally.
and only on platforms supporting immobile code - these are the functions and/or function-
names which commence a depth-first scan of code when reordering based on the statically
observable call chain. The complete set of reachable objects is not affected per se. This
argument is meaningless if neither enabling precondition holds.
:environment-name
This has no purpose; it is accepted only for legacy compatibility.
:compression
This is only meaningful if the runtime was built with the :sb-core-compression feature
enabled. If nil (the default), saves to uncompressed core files. If :sb-core-compression
was enabled at build-time, the argument may also be an integer from -1 to 9, corresponding
to zlib compression levels, or t (which is equivalent to the default compression level, -1).
:application-type
Present only on Windows and is meaningful only with :executable t. Specifies the sub-
system of the executable, :console or :gui. The notable difference is that :gui doesn’t
automatically create a console window. The default is :console.
The save/load process changes the values of some global variables:
*standard-output*, *debug-io*, etc.
Everything related to open streams is necessarily changed, since the os won’t let us preserve
a stream across save and load.
*default-pathname-defaults*
This is reinitialized to reflect the working directory where the saved core is loaded.
save-lisp-and-die interacts with sb-alien:load-shared-object: see its documentation for details.
On threaded platforms only a single thread may remain running after sb-ext:*save-hooks* have run.
Applications using multiple threads can be save-lisp-and-die friendly by registering a save-hook that
quits any additional threads, and an init-hook that restarts them.
This implementation is not as polished and painless as you might like:
• It corrupts the current Lisp image enough that the current process needs to be killed afterwards.
This can be worked around by forking another process that saves the core.
• There is absolutely no binary compatibility of core images between different runtime support pro-
grams. Even runtimes built from the same sources at different times are treated as incompatible for
this purpose.
This isn’t because we like it this way, but just because there don’t seem to be good quick fixes for either
limitation and no one has been sufficiently motivated to do lengthy fixes.
sb-ext:*save-hooks* [Variable]
A list of function designators which are called in an unspecified order before creating a saved core image.
Unused by sbcl itself: reserved for user and applications.
In cases where the standard initialization files have already been loaded into the saved core, and alter-
native ones should be used (or none at all), SBCL allows customizing the initfile pathname computation.
sb-ext:*sysinit-pathname-function* [Variable]
Designator for a function of zero arguments called to obtain a pathname designator for the default sysinit
file, or nil. If the function returns nil, no sysinit file is used unless one has been specified on the
command-line.
sb-ext:*userinit-pathname-function* [Variable]
Designator for a function of zero arguments called to obtain a pathname designator or a stream for the
default userinit file, or nil. If the function returns nil, no userinit file is used unless one has been
specified on the command-line.
To facilitate distribution of SBCL applications using external resources, the filesystem location of the
SBCL core file being used is available from Lisp.
sb-ext:*core-pathname* [Variable]
The absolute pathname of the running sbcl core.
Chapter 3: Starting and Stopping 12
--core corefilename
Run the specified Lisp core file instead of the default. Note that if the Lisp core file is a
user-created core file, it may run a nonstandard toplevel which does not recognize the standard
toplevel options.
--dynamic-space-size megabytes
Size of the dynamic space reserved on startup in megabytes. Default value is platform depen-
dent.
--control-stack-size megabytes
Size of control stack reserved for each thread in megabytes. Default value is 2.
--noinform
Suppress the printing of any banner or other informational message at startup. This makes it
easier to write Lisp programs which work cleanly in Unix pipelines. See also the --noprint
and --disable-debugger options.
--disable-ldb
Disable the low-level debugger. Only effective if SBCL is compiled with LDB.
--lose-on-corruption
There are some dangerous low level errors (for instance, control stack exhausted, memory
fault) that (or whose handlers) can corrupt the image. By default SBCL prints a warning, then
tries to continue and handle the error in Lisp, but this will not always work and SBCL may
malfunction or even hang. With this option, upon encountering such an error SBCL will invoke
ldb (if present and enabled) or else exit.
--script filename
As a runtime option this is equivalent to --noinform --disable-ldb --lose-on-corruption
--end-runtime-options --script filename. See the description of --script as a toplevel
option below. If there are no other command line arguments following --script, the filename
argument can be omitted.
Chapter 3: Starting and Stopping 13
--merge-core-pages
When platform support is present, provide hints to the operating system that identical pages
may be shared between processes until they are written to. This can be useful to reduce the
memory usage on systems with multiple SBCL processes started from similar but differently-
named core files, or from compressed cores. Without platform support, do nothing. By default
only compressed cores trigger hinting.
--no-merge-core-pages
Ensures that no sharing hint is provided to the operating system.
--help Print some basic information about SBCL, then exit.
--version Print SBCL’s version information, then exit.
In the future, runtime options may be added to control behaviour such as lazy allocation of memory.
Runtime options, including any –end-runtime-options option, are stripped out of the command line before
the Lisp toplevel logic gets a chance to see it.
--sysinit filename
Load filename instead of the default system initialization file (see Section 3.4 [Initialization
Files], page 14.)
--no-sysinit
Don’t load a system-wide initialization file. If this option is given, the --sysinit option is
ignored.
--userinit filename
Load filename instead of the default user initialization file (see Section 3.4 [Initialization Files],
page 14.)
--no-userinit
Don’t load a user initialization file. If this option is given, the --userinit option is ignored.
--eval command
After executing any initialization file, but before starting the read-eval-print loop on standard
input, read and evaluate the command given. More than one --eval option can be used, and
all will be read and executed, in the order they appear on the command line.
--load filename
This is equivalent to --eval ’(load "filename")’. The special syntax is intended to reduce
quoting headaches when invoking SBCL from shell scripts.
--noprint When ordinarily the toplevel "read-eval-print loop" would be executed, execute a "read-eval
loop" instead, i.e. don’t print a prompt and don’t echo results. Combined with the --noinform
runtime option, this makes it easier to write Lisp "scripts" which work cleanly in Unix pipelines.
--disable-debugger
By default when SBCL encounters an error, it enters the builtin debugger, allowing interactive
diagnosis and possible intercession. This option disables the debugger, causing errors to print
a backtrace and exit with status 1 instead. When given, this option takes effect before loading
of initialization files or processing --eval and --load options. See sb-ext:disable-debugger
for details. See Section 5.1 [Debugger Entry], page 26.
--script filename
Implies --no-userinit --no-sysinit --disable-debugger --end-toplevel-options.
Causes the system to load the specified file instead of entering the read-eval-print-loop, and
exit afterwards. If the file begins with a shebang line, it is ignored.
If there are no other command line arguments following, the filename can be omitted: this
causes the script to be loaded from standard input instead. Shebang lines in standard input
script are currently not ignored.
In either case, if there is an unhandled error (e.g. end of file, or a broken pipe) on either
standard input, standard output, or standard error, the script silently exits with code 0. This
allows e.g. safely piping output from SBCL to head -n1 or similar.
Chapter 3: Starting and Stopping 14
4 Compiler
This chapter will discuss most compiler issues other than efficiency, including compiler error messages, the
SBCL compiler’s unusual approach to type safety in the presence of type declarations, the effects of various
compiler optimization policies, and the way that inlining and open coding may cause optimized code to
differ from a naive translation. Efficiency issues are sufficiently varied and separate that they have their own
chapter, Chapter 6 [Efficiency], page 37.
sb-ext:muffle-conditions [Declaration]
Syntax: type*
Muffles the diagnostic messages that would be caused by compile-time signals of given types.
sb-ext:unmuffle-conditions [Declaration]
Syntax: type*
Cancels the effect of a previous sb-ext:muffle-conditions declaration.
Various details of how the compiler messages are printed can be controlled via the alist
sb-ext:*compiler-print-variable-alist*.
sb-ext:*compiler-print-variable-alist* [Variable]
an association list describing new bindings for special variables to be used by the compiler for error-
reporting, etc. Eg.
((*PRINT-LENGTH* . 10) (*PRINT-LEVEL* . 6) (*PRINT-PRETTY* . NIL))
The variables in the car positions are bound to the values in the cdr during the execution of some debug
commands. When evaluating arbitrary expressions in the debugger, the normal values of the printer
control variables are in effect.
Initially empty, *compiler-print-variable-alist* is Typically used to specify bindings for printer
control variables.
For information about muffling warnings signaled outside of the compiler, see Section 7.9 [Customization
Hooks for Users], page 59.
Chapter 4: Compiler 16
sb-ext:compiler-note [Condition]
Class precedence list: compiler-note, condition, t
Root of the hierarchy of conditions representing information discovered by the compiler that the user
might wish to know, but which does not merit a style-warning (or any more serious condition).
sb-ext:code-deletion-note [Condition]
Class precedence list: code-deletion-note, compiler-note, condition, t
A condition type signalled when the compiler deletes code that the user has written, having proved that
it is unreachable.
2. ‘in: DEFUN FOO’ This is the definition top level form responsible for the diagnostic. It is obtained by
taking the first two elements of the enclosing form whose first element is a symbol beginning with
“‘def’”. If there is no such enclosing “‘def’” form, then the outermost form is used. If there are
multiple ‘def’ forms, then they are all printed from the outside in, separated by ‘=>’’s. In this example,
the problem was in the defun for foo.
3. ‘(ZOQ Y)’ This is the original source form responsible for the diagnostic. Original source means that
the form directly appeared in the original input to the compiler, i.e. in the lambda passed to compile
or in the top level form read from the source file. In this example, the expansion of the zoq macro was
responsible for the message.
4. ‘--> ROQ PLOQ’ This is the processing path that the compiler used to produce the code that caused
the message to be emitted. The processing path is a representation of the evaluated forms enclosing
the actual source that the compiler encountered when processing the original source. The path is the
first element of each form, or the form itself if the form is not a list. These forms result from the
expansion of macros or source-to-source transformation done by the compiler. In this example, the
enclosing evaluated forms are the calls to roq and ploq. These calls resulted from the expansion of the
zoq macro.
5. ‘==> (+ Y 3)’ This is the actual source responsible for the diagnostic. If the actual source appears in
the explanation, then we print the next enclosing evaluated form, instead of printing the actual source
twice. (This is the form that would otherwise have been the last form of the processing path.) In this
example, the problem is with the evaluation of the reference to the variable y.
6. ‘caught WARNING: Asserted type NUMBER conflicts with derived type (VALUES SYMBOL
&OPTIONAL).’ This is the explanation of the problem. In this example, the problem is that, while
the call to + requires that its arguments are all of type number, the compiler has derived that y will
evaluate to a symbol. Note that ‘(VALUES SYMBOL &OPTIONAL)’ expresses that y evaluates to precisely
one value.
Note that each part of the message is distinctively marked:
• ‘file:’ and ‘in:’ mark the file and definition, respectively.
• The original source is an indented form with no prefix.
• Each line of the processing path is prefixed with ‘-->’
• The actual source form is indented like the original source, but is marked by a preceding ‘==>’ line.
• The explanation is prefixed with the diagnostic severity, which can be ‘caught ERROR:’, ‘caught
WARNING:’, ‘caught STYLE-WARNING:’, or ‘note:’.
Each part of the message is more specific than the preceding one. If consecutive messages are for nearby
locations, then the front part of the messages would be the same. In this case, the compiler omits as much
of the second message as in common with the first. For example:
; file: /tmp/foo.lisp
; in: DEFUN FOO
; (ZOQ Y)
; --> ROQ
; ==>
; (PLOQ (+ Y 3))
;
; caught STYLE-WARNING:
; undefined function: PLOQ
; ==>
; (ROQ (PLOQ (+ Y 3)))
;
; caught STYLE-WARNING:
; undefined function: ROQ
In this example, the file, definition and original source are identical for the two messages, so the compiler
omits them in the second message. If consecutive messages are entirely identical, then the compiler prints
only the first message, followed by: ‘[Last message occurs repeats times]’ where repeats is the number
of times the message was given.
Chapter 4: Compiler 18
If the source was not from a file, then no file line is printed. If the actual source is the same as the
original source, then the processing path and actual source will be omitted. If no forms intervene between
the original source and the actual source, then the processing path will also be omitted.
To gain maximum benefit from the compiler’s type checking, you should always declare the types of
function arguments and structure slots as precisely as possible. This often involves the use of or, member,
and other list-style type specifiers.
1
Actually, this declaration is unnecessary in SBCL, since it already knows that position returns a non-negative
fixnum or nil.
2
A deprecated extension sb-ext:inhibit-warnings is still supported, but liable to go away at any time.
Chapter 4: Compiler 22
Ordinarily, when the speed quality is high, the compiler emits notes to notify the programmer about its
inability to apply various optimizations. For selective muffling of these notes See Section 4.1.1 [Controlling
Verbosity], page 15.
The value of space mostly influences the compiler’s decision whether to inline operations, which tend
to increase the size of programs. Use the value 0 with caution, since it can cause the compiler to inline
operations so indiscriminately that the net effect is to slow the program by causing cache misses or even
swapping.
sb-ext:describe-compiler-policy &optional spec [Function]
Print all global optimization settings, augmented by spec.
sb-ext:restrict-compiler-policy &optional quality min max [Function]
Assign a minimum value to an optimization quality. quality is the name of the optimization quality to
restrict, min (defaulting to zero) is the minimum allowed value, and max (defaults to 3) is the maximum.
Returns the alist describing the current policy restrictions.
If quality is nil or not given, nothing is done.
Otherwise, if min is zero or max is 3 or neither are given, any existing restrictions of quality are removed.
See also :policy option in with-compilation-unit.
cl:with-compilation-unit options &body body [Macro]
Affects compilations that take place within its dynamic extent. It is intended to be eg. wrapped around
the compilation of all files in the same system.
Following options are defined:
:override Boolean-Form
One of the effects of this form is to delay undefined warnings until the end of the form,
instead of giving them at the end of each compilation. If override is nil (the default),
then the outermost with-compilation-unit form grabs the undefined warnings. Specifying
override true causes that form to grab any enclosed warnings, even if it is enclosed by
another with-compilation-unit.
:policy Optimize-Declaration-Form
Provides dynamic scoping for global compiler optimization qualities and restrictions, limiting
effects of subsequent optimize proclamations and calls to sb-ext:restrict-compiler-
policy to the dynamic scope of body.
If override is false, specified policy is merged with current global policy. If override is
true, current global policy, including any restrictions, is discarded in favor of the specified
policy.
Supplying policy nil is equivalent to the option not being supplied at all, ie. dynamic
scoping of policy does not take place.
This option is an SBCL-specific experimental extension: Interface subject to change.
:source-namestring Namestring-Form
Attaches the value returned by the Namestring-Form to the internal debug-source infor-
mation as the namestring of the source file. Normally the namestring of the input-file
for compile-file is used: this option can be used to provide source-file information for
functions compiled using compile, or to override the input-file of compile-file.
If both an outer and an inner with-compilation-unit provide a source-namestring, the
inner one takes precedence. Unaffected by :override.
This is an SBCL-specific extension.
:source-plist Plist-Form
Attaches the value returned by the Plist-Form to internal debug-source information of func-
tions compiled in within the dynamic extent of body.
Primarily for use by development environments, in order to eg. associate function definitions
with editor-buffers. Can be accessed using sb-introspect:definition-source-plist.
If an outer with-compilation-unit form also provide a source-plist, it is appended to
the end of the provided source-plist. Unaffected by :override.
This is an SBCL-specific extension.
Chapter 4: Compiler 23
Examples:
;; Prevent proclamations from the file leaking, and restrict
;; SAFETY to 3 -- otherwise uses the current global policy.
(with-compilation-unit (:policy ’(optimize))
(restrict-compiler-policy ’safety 3)
(load "foo.lisp"))
4.6 Interpreter
By default SBCL implements eval by calling the native code compiler.
SBCL also includes an interpreter for use in special cases where using the compiler is undesirable, for
example due to compilation overhead. Unlike in some other Lisp implementations, in SBCL interpreted code
is not safer or more debuggable than compiled code.
sb-ext:*evaluator-mode* [Variable]
Toggle between different evaluator implementations. If set to :compile, an implementation of eval that
calls the compiler will be used. If set to :interpret, an interpreter will be used.
26
5 Debugger
This chapter documents the debugging facilities of SBCL, including the debugger, single-stepper and trace,
and the effect of (optimize debug) declarations.
You can type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
sb-ext:*invoke-debugger-hook* [Variable]
This is either nil or a designator for a function of two arguments, to be run when the debugger is about
to be entered. The function is run with *invoke-debugger-hook* bound to nil to minimize recursive
errors, and receives as arguments the condition that triggered debugger entry and the previous value of
*invoke-debugger-hook*
This mechanism is an sbcl extension similar to the standard *debugger-hook*. In contrast to
*debugger-hook*, it is observed by invoke-debugger even when called by break.
additional input. Debugger commands can be abbreviated by any unambiguous prefix: help can be typed
as ‘h’, ‘he’, etc.
The package is not significant in debugger commands; any symbol with the name of a debugger command
will work. If you want to show the value of a variable that happens also to be the name of a debugger
command you can wrap the variable in a progn to hide it from the command loop.
The debugger prompt is “frame]”, where frame is the number of the current frame. Frames are numbered
starting from zero at the top (most recent call), increasing down to the bottom. The current frame is the
frame that commands refer to.
It is possible to override the normal printing behaviour in the debugger by using the sb-ext:*debug-
print-variable-alist*.
sb-ext:*debug-print-variable-alist* [Variable]
an association list describing new bindings for special variables to be used within the debugger. Eg.
((*PRINT-LENGTH* . 10) (*PRINT-LEVEL* . 6) (*PRINT-PRETTY* . NIL))
The variables in the car positions are bound to the values in the cdr during the execution of some debug
commands. When evaluating arbitrary expressions in the debugger, the normal values of the printer
control variables are in effect.
Initially empty, *debug-print-variable-alist* is typically used to provide bindings for printer control
variables.
...)
Usually the elimination of tail-recursive frames makes debugging more pleasant, since these frames are
mostly uninformative. If there is any doubt about how one function called another, it can usually be
eliminated by finding the source location in the calling frame. See Section 5.5 [Source Location Printing],
page 31.
The elimination of tail-recursive frames can be prevented by disabling tail-recursion optimization, which
happens when the debug optimization quality is greater than 2. See Section 5.6 [Debugger Policy Control],
page 32.
identifier is used to disambiguate the variable name; use list-locals to find out the identifiers.
1
Since the location of an interrupt or hardware error will always be an unknown location, non-argument variable
values will never be available in the interrupted frame. See Section 5.3.5 [Unknown Locations and Interrupts],
page 29.
2
The variable bindings are actually created using the Lisp symbol-macrolet special form.
Chapter 5: Debugger 31
(+ *some-random-special* ...)
If the code at a location was generated from the expansion of a macro or a source-level compiler opti-
mization, then the form in the original source that expanded into that code will be printed. Suppose the file
/usr/me/mystuff.lisp looked like this:
(defmacro mymac ()
’(myfun))
(defun foo ()
(mymac)
...)
If foo has called myfun, and is waiting for it to return, then the source command would print:
; File: /usr/me/mystuff.lisp
(MYMAC)
Note that the macro use was printed, not the actual function call form, (myfun).
If enclosing source is printed by giving an argument to source or vsource, then the actual source form
is marked by wrapping it in a list whose first element is ‘#:***HERE***’. In the previous example, source
1 would print:
; File: /usr/me/mystuff.lisp
(DEFUN FOO ()
(#:***HERE***
(MYMAC))
...)
• No top-level forms before the top-level form containing the source have been added or deleted, and
• The top-level form containing the source has not been modified much. (More precisely, none of the list
forms beginning before the source form have been added or deleted.)
If the heuristic doesn’t work, the displayed source will be wrong, but will probably be near the actual
source. If the “shape” of the top-level form in the source file is too different from the original form, then an
error will be signaled. When the heuristic is used, the source location commands are noticeably slowed.
Source location printing can also be confused if (after the source was compiled) a read-macro you used in
the code was redefined to expand into something different, or if a read-macro ever returns the same eq list
twice. If you don’t define read macros and don’t use ## in perverted ways, you don’t need to worry about
this.
2 Level 1 plus all interned local variables, source location information, and lifetime information
that tells the debugger when arguments are available (even when speed is 3 or the argument
is set).
>2 Any level greater than 2 gives level 2 and in addition disables tail-call optimization, so that
the backtrace will contain frames for all invoked functions, even those in tail positions.
3 Level 2 plus all uninterned variables. In addition, lifetime analysis is disabled (even when speed
is 3), ensuring that all variable values are available at any known location within the scope of
the binding. This has a speed penalty in addition to the obvious space penalty.
> (max speed space)
If debug is greater than both speed and space, the command return can be used to continue
execution by returning a value from the current stack frame.
> (max speed space compilation-speed)
If debug is greater than all of speed, space and compilation-speed the code will be steppable
(see Section 5.10 [Single Stepping], page 35).
As you can see, if the speed quality is 3, debugger performance is degraded. This effect comes from
the elimination of argument variable special-casing (see Section 5.4.1 [Variable Value Availability], page 30).
Some degree of speed/debuggability tradeoff is unavoidable, but the effect is not too drastic when debug is
at least 2.
In addition to inline and notinline declarations, the relative values of the speed and space qualities
also change whether functions are inline expanded. If a function is inline expanded, then there will be no
frame to represent the call, and the arguments will be treated like any other local variable. Functions may
also be “semi-inline”, in which case there is a frame to represent the call, but the call is to an optimized
local version of the function, not to the original function.
:wherein Names
If specified, Names is a function name or list of names. trace does nothing unless a call to
one of those functions encloses the call to this function (i.e. it would appear in a backtrace.)
Anonymous functions have string names like "DEFUN FOO".
:encapsulate {:DEFAULT | t | NIL}
If t, the default, tracing is done via encapsulation (redefining the function name) rather than
by modifying the function. :default is not the default, but means to use encapsulation for
interpreted functions and funcallable instances, breakpoints otherwise. When encapsulation
is used, forms are *not* evaluated in the function’s lexical environment, but sb-debug:arg
can still be used.
:methods {T | NIL}
If t, any function argument naming a generic function will have its methods traced in
addition to the generic function itself.
:function Function-Form
This is a not really an option, but rather another way of specifying what function to trace.
The Function-Form is evaluated immediately, and the resulting function is traced.
:condition, :break and :print forms are evaluated in a context which mocks up the lexical environment
of the called function, so that sb-debug:var and sb-debug:arg can be used. The -after and -all forms
can use sb-debug:arg.
cl:untrace &rest specs [Macro]
Remove tracing from the specified functions. Untraces all functions when called with no arguments.
sb-debug:*trace-indentation-step* [Variable]
the increase in trace indentation at each call level
sb-debug:*max-trace-indentation* [Variable]
If the trace indentation exceeds this value, then indentation restarts at 0.
sb-debug:*trace-encapsulate-default* [Variable]
the default value for the :encapsulate option to trace
6 Efficiency
...)
sb-ext:global [Declaration]
Syntax: (sb-ext:global symbol*)
Only valid as a global proclamation.
Specifies that the named symbols cannot be proclaimed or locally declared special. Proclaiming an
already special or constant variable name as global signal an error. Allows more efficient value lookup
in threaded environments in addition to expressing programmer intention.
Chapter 6: Efficiency 40
sb-ext:always-bound [Declaration]
Syntax: (sb-ext:always-bound symbol*)
Only valid as a global proclamation.
Specifies that the named symbols are always bound. Inhibits makunbound of the named symbols. Pro-
claiming an unbound symbol as always-bound signals an error. Allows the compiler to elide boundness
checks from value lookups.
• cases where local compilation policy does not require excessive type checking, e.g. (locally (declare
(safety 1)) (assoc item list)) (which currently performs safe endp checking internal to assoc).
If your system’s performance is suffering because of some construct which could in principle be compiled
efficiently, but which the SBCL compiler can’t in practice compile efficiently, consider writing a patch to the
compiler and submitting it for inclusion in the main sources. Such code is often reasonably straightforward
to write; search the sources for the string “deftransform” to find many examples (some straightforward,
some less so).
42
sb-ext:*on-package-variance* [Variable]
Specifies behavior when redefining a package using defpackage and the definition is in variance with the
current state of the package.
The value should be of the form:
(:WARN [T | packages-names] :ERROR [T | package-names])
specifying which packages get which behaviour -- with t signifying the default unless otherwise specified.
If default is not specified, :warn is used.
:warn keeps as much state as possible and causes sbcl to signal a full warning.
:error causes sbcl to signal an error when the variant defpackage form is executed, with restarts
provided for user to specify what action should be taken.
Example:
(setf *on-package-variance* ’(:warn (:swank :swank-backend) :error t))
specifies to signal a warning if swank package is in variance, and an error otherwise.
7.4.1 Finalization
Finalization allows code to be executed after an object has been garbage collected. This is useful for example
for releasing foreign memory associated with a Lisp object.
sb-ext:finalize object function &key dont-save [Function]
Arrange for the designated function to be called when there are no more references to object, including
references in function itself.
If dont-save is true, the finalizer will be cancelled when save-lisp-and-die is called: this is useful
for finalizers deallocating system memory, which might otherwise be called with addresses from the old
image.
In a multithreaded environment function may be called in any thread. In both single and multithreaded
environments function may be called in any dynamic scope: consequences are unspecified if function
is not fully re-entrant.
Errors from function are handled and cause a warning to be signalled in whichever thread the function
was called in.
Examples:
;;; GOOD, assuming RELEASE-HANDLE is re-entrant.
(let* ((handle (get-handle))
(object (make-object handle)))
(finalize object (lambda () (release-handle handle)))
object)
(defun oops ()
(when *rec*
(error "recursive OOPS"))
(let ((*rec* t))
(gc))) ; or just cons enough to cause one
(progn
(finalize "oops" #’oops)
(oops)) ; GC causes re-entry to #’oops due to the finalizer
; -> ERROR, caught, WARNING signalled
sb-ext:cancel-finalization object [Function]
Cancel all finalizations for object.
sb-ext:*gc-run-time* [Variable]
Total cpu time spent doing garbage collection (as reported by get-internal-run-time.) Initialized to
zero on startup. It is safe to bind this to zero in order to measure gc time inside a certain section of
code, but doing so may interfere with results reported by eg. time.
sb-ext:bytes-consed-between-gcs [Function]
The amount of memory that will be allocated before the next garbage collection is initiated. This can be
set with setf.
On gencgc platforms this is the nursery size, and defaults to 5% of dynamic space size.
Note: currently changes to this value are lost when saving core.
sb-ext:dynamic-space-size [Function]
Size of the dynamic space in bytes.
sb-ext:get-bytes-consed [Function]
Return the number of bytes consed since the program began. Typically this result will be a consed bignum,
so if you have an application (e.g. profiling) which can’t tolerate the overhead of consing bignums, you’ll
probably want either to hack in at a lower level (as the code in the sb-profile package does), or to
design a more microefficient interface and submit it as a patch.
sb-ext:gc-logfile [Function]
Return the pathname used to log garbage collections. Can be setf. Default is nil, meaning collections
are not logged. If non-null, the designated file is opened before and after each collection, and generation
statistics are appended to it.
sb-ext:generation-average-age generation [Function]
Average age of memory allocated to generation: average number of times objects allocated to the
generation have seen younger objects promoted to it. Available on gencgc platforms only.
Experimental: interface subject to change.
Chapter 7: Beyond the ANSI Standard 46
:verbose Return no values. Print discovered paths using a verbose format with each node of each
path on a separate line.
true (other than :verbose)
Return no values. Print discovered paths using a compact format with all nodes of each
path on a single line.
nil Do not print any output. Instead return the discovered paths as a list of lists. Each list has
the form
(target . (root node*))
where target is one of the target of one of the weak-pointers.
root is a description of the root at which the path starts and has one of the following forms:
:static If the root of the path is a non-collectible heap object.
:pinned If an unknown thread stack pins the root of the path.
((thread-name | thread-object) symbol currentp) If the path begins at a special binding
of symbol in a thread. currentp is a boolean indicating whether the value is current or
shadowed by another binding.
((thread-name | thread-object) guessed-pc) If the path begins at a lexical variable in
the function whose code contains guessed-pc.
Each node in the remainder of the path is a cons (object . slot) indicating that the slot
at index slot in object references the next path node.
Experimental: subject to change without prior notice.
An example of using this could look like this:
* (defvar *my-string* (list 1 2 "my string"))
*MY-STRING*
• the class named by the name argument to ensure-class, if any, is only redefined if it is the proper
name of that class; otherwise, a new class is created.
This is consistent with the description of ensure-class in AMOP as the functional version of defclass,
which has this behaviour; however, it is not consistent with the weaker requirement in AMOP, which
states that any class found by find-class, no matter what its class-name, is redefined.
• an error is not signaled in the case of the :name initialization argument for slot-definition objects
being a constant, when the slot definition is of type structure-slot-definition (i.e. it is associated
with a class of type structure-class).
This allows code which uses constant names for structure slots to continue working as specified in ANSI,
while enforcing the constraint for all other types of slot.
• the class named t is not an instance of the built-in-class metaclass.
AMOP specifies, in the “Inheritance Structure of Metaobject Classes” section, that the class named t
should be an instance of built-in-class. However, it also specifies that validate-superclass should
return true (indicating that a direct superclass relationship is permissible) if the second argument is the
class named t. Also, ANSI specifies that classes with metaclass built-in-class may not be subclassed
using defclass, and also that the class named t is the universal superclass, inconsistent with it being
a built-in-class.
• sb-sequence:copy-seq
• sb-sequence:fill
•
sb-ext:*module-provider-functions* [Variable]
See function documentation for require.
Although SBCL does not provide a resident editor, the ed function can be customized to hook into
user-provided editing mechanisms as follows:
sb-ext:*ed-functions* [Variable]
See function documentation for ed.
Conditions of type warning and style-warning are sometimes signaled at runtime, especially during
execution of Common Lisp defining forms such as defun, defmethod, etc. To muffle these warnings at
runtime, SBCL provides a variable sb-ext:*muffled-warnings*:
sb-ext:*muffled-warnings* [Variable]
A type that ought to specify a subtype of warning. Whenever a warning is signaled, if the warning is of
this type and is not handled by any other handler, it will be muffled.
Note: The :hash-function keyword argument to make-hash-table can be used to override the specified
default hash-function.
Attempting to define name in a locked package as hash-table test causes a package lock violation.
Examples:
;;; 1.
;;; 2.
(defun == (x y) (= x y))
(define-hash-table-test ==
(lambda (x)
;; Hash codes must be consistent with test, so
;; not (SXHASH X), since
;; (= 1 1.0) => T
;; (= (SXHASH 1) (SXHASH 1.0)) => NIL
;; Note: this doesn’t deal with complex numbers or
;; bignums too large to represent as double floats.
(sxhash (coerce x ’double-float))))
SBCL on the same platform, using the same code under the same evaluator mode and compiler optimization
qualities. Just two examples of differences that may occur otherwise: calls to random can be compiled
differently depending on how much is known about the limit argument at compile time, yielding different
results even if called with the same argument at run time, and the results can differ depending on the
machine’s word size, for example for limits that are fixnums under 64-bit word size but bignums under 32-bit
word size.
Some notes on random floats: The standard doesn’t prescribe a specific method of generating random
floats. The following paragraph describes SBCL’s current implementation and should be taken as purely
informational, that is, user code should not depend on any of its specific properties. The method used has
been chosen because it is common, conceptually simple and fast.
To generate random floats, SBCL evaluates code that has an equivalent effect as
(* limit
(float (/ (random (expt 2 23)) (expt 2 23)) 1.0f0))
(for single-floats) and correspondingly (with 52 and 1.0d0 instead of 23 and 1.0f0) for double-floats.
Note especially that this means that zero is a possible return value occurring with probability (expt 2 -23)
respectively (expt 2 -52). Also note that there exist twice as many equidistant floats between 0 and 1 as
are generated. For example, the largest number that (random 1.0f0) ever returns is (float (/ (1- (expt
2 23)) (expt 2 23)) 1.0f0) while (float (/ (1- (expt 2 24)) (expt 2 24)) 1.0f0) is the largest single-
float less than 1. This is a side effect of the fact that the implementation uses the fastest possible conversion
from bits to floats.
SBCL currently uses the Mersenne Twister as its random number generator, specifically the 32-bit version
under both 32- and 64-bit word size. The seeding algorithm has been improved several times by the authors of
the Mersenne Twister; SBCL uses the third version (from 2002) which is still the most recent as of June 2012.
The implementation has been tested to provide output identical to the recommended C implementation.
While the Mersenne Twister generates random numbers of much better statistical quality than other
widely used generators, it uses only linear operations modulo 2 and thus fails some statistical tests4 . For ex-
ample, the distribution of ranks of (sufficiently large) random binary matrices is much distorted compared to
the theoretically expected one when the matrices are generated by the Mersenne Twister. Thus, applications
that are sensitive to this aspect should use a different type of generator.
4
See chapter 7 "Testing widely used RNGs" in TestU01: A C Library for Empirical Testing of Random Number
Generators by Pierre L’Ecuyer and Richard Simard, ACM Transactions on Mathematical Software, Vol. 33,
article 22, 2007.
Chapter 7: Beyond the ANSI Standard 63
Expiration of deadlines set up this way only has an effect when it happens before or during the execution of
a deadline-aware operation (see Section 7.14.4 [Operations Supporting Timeouts and Deadlines], page 64).
In this case, a sb-sys:deadline-timeout is signaled. A handler for this condition type may use the
sb-sys:defer-deadline or sb-sys:cancel-deadline restarts to defer or cancel the deadline respectively
and resume execution of the interrupted operation.
sb-sys:deadline-timeout [Condition]
Class precedence list: deadline-timeout, timeout, serious-condition, condition, t
Signaled when an operation in the context of a deadline takes longer than permitted by the deadline.
When a thread is executing the debugger, signaling of sb-sys:deadline-timeout conditions for that
thread is deferred until it exits the debugger.
Example:
(defun read-input ()
(list (read-line) (read-line)))
(defun do-it ()
(sb-sys:with-deadline (:seconds 5))
(read-input)
(sleep 2)
(sb-ext:run-program "my-program"))
The above code establishes a deadline of five seconds within which the body of the do-it function should
execute. All calls of deadline-aware functions in the dynamic scope, in this case two read-line calls, a sleep
call and a sb-ext:run-program call, are affected by the deadline. If, for example, the first read-line call
completes in one second and the second read-line call completes in three seconds, a sb-sys:deadline-
timeout condition will be signaled after the sleep call has been executing for one second.
spec and it didn’t occur to me that it was in the IEEE spec). If you need this stuff, take a look at the code
and bring it up on the developers’ mailing list.
8 External Formats
External formats determine the coding of characters from/to sequences of octets when exchanging data with
the outside world. Examples of such exchanges are:
1. Character streams associated with files, sockets and process input/output (See Section 11.1 [Stream
External Formats], page 84, and Section 7.7.3 [Running external programs], page 53)
2. Names of files
3. Foreign strings (See Section 9.2.2 [Foreign Types and Lisp Types], page 72)
4. Posix interface (See Section 17.6 [sb-posix], page 133)
5. Hostname- and protocol-related functions of the BSD-socket interface (See Chapter 15 [Networking],
page 109)
Technically, external formats in SBCL are named objects describing coding of characters as well as policies
in case de- or encoding is not possible. Each external format has a canonical name and zero or more aliases.
User code mostly interacts with external formats by supplying external format designators to functions that
use external formats internally.
(read-line stream))
will read the first line of pathname, replacing any octet sequence that is not valid in the UTF-8
external format with a question mark character.
:ISO-8859-9
:|iso-8859-9|, :LATIN-5, :|latin-5|
:KOI8-R :|koi8-r|
:KOI8-U :|koi8-u|
:LATIN-1 :LATIN1, :ISO-8859-1, :ISO8859-1
:LATIN-9 :LATIN9, :ISO-8859-15, :ISO8859-15
:MAC-ROMAN
:|mac-roman|, :|MacRoman|, :MAC, :|mac|, :MACINTOSH, :|macintosh|
:SHIFT_JIS
:SJIS, :|Shift_JIS|, :CP932
:UCS-2BE :UCS2BE
:UCS-2LE :UCS2LE
:UCS-4BE :UCS4BE
:UCS-4LE :UCS4LE
:UTF-16BE :UTF16BE
:UTF-16LE :UTF16LE
:UTF-32BE :UTF32BE
:UTF-32LE :UTF32LE
:UTF-8 :UTF8
:X-MAC-CYRILLIC
:|x-mac-cyrillic|
71
• The foreign type specifier (boolean &optional bits) is similar to an enumeration type, but maps from
Lisp nil and t to C 0 and 1 respectively. bits determines the amount of storage allocated to hold the
truth value.
• The foreign type specifier single-float describes a floating-point number in IEEE single-precision
format.
• The foreign type specifier double-float describes a floating-point number in IEEE double-precision
format.
• The foreign type specifier (function result-type &rest arg-types) describes a foreign function that
takes arguments of the specified arg-types and returns a result of type result-type. Note that the only
context where a foreign function type is directly specified is in the argument to sb-alien:alien-
funcall. In all other contexts, foreign functions are represented by foreign function pointer types: (*
(function ...)).
• The foreign type specifier sb-alien:system-area-pointer describes a pointer which is represented in
Lisp as a system-area-pointer object. SBCL exports this type from sb-alien because CMUCL did,
but tentatively (as of the first draft of this section of the manual, SBCL 0.7.6) it is deprecated, since it
doesn’t seem to be required by user code.
• The foreign type specifier sb-alien:void is used in function types to declare that no useful value is
returned. Using alien-funcall to call a void foreign function will return zero values.
• The foreign type specifier (sb-alien:c-string &key external-format element-type not-null) is
similar to (* char), but is interpreted as a null-terminated string, and is automatically converted into
a Lisp string when accessed; or if the pointer is C NULL or 0, then accessing it gives Lisp nil unless
not-null is true, in which case a type-error is signalled.
External format conversion is automatically done when Lisp strings are passed to foreign code, or when
foreign strings are passed to Lisp code. If the type specifier has an explicit external-format, that
external format will be used. Otherwise a default external format that has been determined at SBCL
startup time based on the current locale settings will be used. For example, when the following alien
routine is called, the Lisp string given as argument is converted to an ebcdic octet representation.
(define-alien-routine test int (str (c-string :external-format :ebcdic-us)))
Lisp strings of type base-string are stored with a trailing NUL termination, so no copying (either
by the user or the implementation) is necessary when passing them to foreign code, assuming that
the external-format and element-type of the c-string type are compatible with the internal rep-
resentation of the string. For an SBCL built with Unicode support that means an external-format
of :ascii and an element-type of base-char. Without Unicode support the external-format can
also be :iso-8859-1, and the element-type can also be character. If the external-format or
element-type is not compatible, or the string is a (simple-array character (*)), this data is copied
by the implementation as required.
Assigning a Lisp string to a c-string structure field or variable stores the contents of the string to the
memory already pointed to by that variable. When a foreign object of type (* char) is assigned to a
c-string, then the c-string pointer is assigned to. This allows c-string pointers to be initialized.
For example:
(cl:in-package "CL-USER") ; which USEs package "SB-ALIEN"
Similarly named functions exist for accessing other sizes of word, other comparisons, and other conver-
sions. The reader is invited to use apropos and describe for more details
(apropos "sap" :sb-sys)
alien-funcall. style specifies how this argument should be handled at call and return time, and should
be one of the following:
• :in specifies that the argument is passed by value. This is the default. :in arguments have no
corresponding return value from the Lisp function.
• :copy is similar to :in, but the argument is copied to a pre-allocated object and a pointer to this
object is passed to the foreign routine.
• :out specifies a pass-by-reference output value. The type of the argument must be a pointer to
a fixed-sized object (such as an integer or pointer). :out and :in-out style cannot be used with
pointers to arrays, records or functions. An object of the correct size is allocated on the stack, and
its address is passed to the foreign function. When the function returns, the contents of this location
are returned as one of the values of the Lisp function (and the location is automatically deallocated).
• :in-out is a combination of :copy and :out. The argument is copied to a pre-allocated object and
a pointer to this object is passed to the foreign routine. On return, the contents of this location is
returned as an additional value.
Note: Any efficiency-critical foreign interface function should be inline expanded, which can
be done by preceding the define-alien-routine call with:
(declaim (inline lisp-name))
In addition to avoiding the Lisp call overhead, this allows pointers, word-integers and floats
to be passed using non-descriptor representations, avoiding consing.)
10 Pathnames
Because some file systems permit the names of directories to be expressed in multiple ways, it is occa-
sionally necessary to parse a native file name “as a directory name” or to produce a native file name that
names a directory “as a file”. For these cases, parse-native-namestring accepts the keyword argument
as-directory to force a filename to parse as a directory, and native-namestring accepts the keyword
argument as-file to force a pathname to unparse as a file. For example,
; On Unix, the directory "/tmp/" can be denoted by "/tmp/" or "/tmp".
; Under the default rules for native filenames, these parse and
; unparse differently.
(defvar *p*)
(setf *p* (parse-native-namestring "/tmp/")) ⇒ #P"/tmp/"
(pathname-name *p*) ⇒ NIL
(pathname-directory *p*) ⇒ (:ABSOLUTE "tmp")
(native-namestring *p*) ⇒ "/tmp/"
11 Streams
Streams which read or write Lisp character data from or to the outside world – files, sockets or other external
entities – require the specification of a conversion between the external, binary data and the Lisp characters.
In ANSI Common Lisp, this is done by specifying the :external-format argument when the stream is
created. The major information required is an encoding, specified by a keyword naming that encoding;
however, it is also possible to specify refinements to that encoding as additional options to the external
format designator.
In addition, SBCL supports various extensions of ANSI Common Lisp streams:
Bivalent Streams
A type of stream that can read and write both character and (unsigned-byte 8) values.
Gray Streams
User-overloadable CLOS classes whose instances can be used as Lisp streams (e.g. passed as
the first argument to format).
Simple Streams
The bundled contrib module sb-simple-streams implements a subset of the Franz Allegro simple-
streams proposal.
sb-gray:fundamental-stream [Class]
Class precedence list: fundamental-stream, standard-object, stream, t
Base class for all Gray streams.
sb-gray:fundamental-input-stream [Class]
Class precedence list: fundamental-input-stream, fundamental-stream, standard-object, stream,
t
Superclass of all Gray input streams.
The function input-stream-p will return true of any generalized instance of fundamental-input-stream.
Chapter 11: Streams 85
sb-gray:fundamental-output-stream [Class]
Class precedence list: fundamental-output-stream, fundamental-stream, standard-object, stream,
t
Superclass of all Gray output streams.
The function output-stream-p will return true of any generalized instance of fundamental-output-stream.
sb-gray:fundamental-binary-stream [Class]
Class precedence list: fundamental-binary-stream, fundamental-stream, standard-object, stream,
t
Superclass of all Gray streams whose element-type is a subtype of unsigned-byte or signed-byte.
Note that instantiable subclasses of fundamental-binary-stream should provide (or inherit) an applicable
method for the generic function stream-element-type.
sb-gray:fundamental-character-stream [Class]
Class precedence list: fundamental-character-stream, fundamental-stream, standard-object,
stream, t
Superclass of all Gray streams whose element-type is a subtype of character.
sb-gray:fundamental-binary-input-stream [Class]
Class precedence list: fundamental-binary-input-stream, fundamental-input-stream,
fundamental-binary-stream, fundamental-stream, standard-object, stream, t
Superclass of all Gray input streams whose element-type is a subtype of unsigned-byte or signed-byte.
sb-gray:fundamental-binary-output-stream [Class]
Class precedence list: fundamental-binary-output-stream, fundamental-output-stream,
fundamental-binary-stream, fundamental-stream, standard-object, stream, t
Superclass of all Gray output streams whose element-type is a subtype of unsigned-byte or signed-byte.
sb-gray:fundamental-character-input-stream [Class]
Class precedence list: fundamental-character-input-stream, fundamental-input-stream,
fundamental-character-stream, fundamental-stream, standard-object, stream, t
Superclass of all Gray input streams whose element-type is a subtype of character.
sb-gray:fundamental-character-output-stream [Class]
Class precedence list: fundamental-character-output-stream, fundamental-output-stream,
fundamental-character-stream, fundamental-stream, standard-object, stream, t
Superclass of all Gray output streams whose element-type is a subtype of character.
(defclass wrapped-character-input-stream
(wrapped-stream fundamental-character-input-stream)
())
(defmethod stream-read-char ((stream wrapped-character-input-stream))
(read-char (stream-of stream) nil :eof))
(defmethod stream-unread-char ((stream wrapped-character-input-stream)
char)
(unread-char char (stream-of stream)))
(defclass counting-character-input-stream
(wrapped-character-input-stream)
((char-count :initform 1 :accessor char-count-of)
(line-count :initform 1 :accessor line-count-of)
(col-count :initform 1 :accessor col-count-of)
(prev-col-count :initform 1 :accessor prev-col-count-of)))
(defmethod stream-read-char ((stream counting-character-input-stream))
(with-accessors ((inner-stream stream-of) (chars char-count-of)
(lines line-count-of) (cols col-count-of)
(prev prev-col-count-of)) stream
(let ((char (call-next-method)))
(cond ((eql char :eof)
:eof)
((char= char #\Newline)
(incf lines)
(incf chars)
(setf prev cols)
(setf cols 1)
char)
(t
(incf chars)
(incf cols)
char)))))
(defmethod stream-unread-char ((stream counting-character-input-stream)
char)
(with-accessors ((inner-stream stream-of) (chars char-count-of)
(lines line-count-of) (cols col-count-of)
(prev prev-col-count-of)) stream
(cond ((char= char #\Newline)
(decf lines)
(decf chars)
(setf cols prev))
(t
(decf chars)
(decf cols)
char))
(call-next-method)))
12 Package Locks
None of the following sections apply to SBCL built without package locking support.
warning: The interface described here is experimental: incompatible changes in future SBCL
releases are possible, even expected: the concept of “implementation packages” and the associ-
ated operators may be renamed; more operations (such as naming restarts or catch tags) may
be added to the list of operations violating package locks.
The actual type of the error depends on circumstances that caused the violation: operations on pack-
ages signal errors of type sb-ext:package-locked-error, and operations on symbols signal errors of type
sb-ext:symbol-package-locked-error.
(defclass foo:point ()
((x :accessor bar:x)
(y :accessor bar:y)))
Chapter 12: Package Locks 93
;;; is equivalent to
13 Threading
SBCL supports a fairly low-level threading interface that maps onto the host operating system’s concept of
threads or lightweight processes. This means that threads may take advantage of hardware multiprocessing
on machines that have more than one CPU, but it does not allow Lisp control of the scheduler. This is found
in the SB-THREAD package.
Threads are part of the default build on x86[-64]/ARM64 Linux and Windows.
They are also supported on: x86[-64] Darwin (Mac OS X), x86[-64] FreeBSD, x86 SunOS (Solaris), PPC
Linux, ARM64 Linux. On these platforms threads must be explicitly enabled at build-time, see INSTALL for
directions.
sb-thread:thread [Structure]
Class precedence list: thread, structure-object, t
Thread type. Do not rely on threads being structs as it may change in future versions.
sb-thread:*current-thread* [Variable]
Bound in each thread to the thread itself.
sb-thread:list-all-threads [Function]
Return a list of the live threads. Note that the return value is potentially stale even before the function
returns, as new threads may be created and old ones may exit at any time.
sb-thread:main-thread [Function]
Returns the main thread of the process.
sb-thread:thread-yield [Function]
Yield the processor to other threads.
sb-thread:thread-error [Condition]
Class precedence list: thread-error, error, serious-condition, condition, t
Conditions of type thread-error are signalled when thread operations fail. The offending thread is
initialized by the :thread initialization argument and read by the function thread-error-thread.
Chapter 13: Threading 98
CAS Protocol
Our compare-and-swap is user-extensible using a protocol similar to setf, allowing users to add CAS
support to new places via e.g. defcas.
At the same time, new atomic operations can be built on top of CAS using get-cas-expansion. See
atomic-update, atomic-push, and atomic-pop for examples of how to do this.
sb-ext:cas place old new [Macro]
Synonym for compare-and-swap.
Additionally defun, defgeneric, defmethod, flet, and labels can be also used to define CAS-functions
analogously to SETF-functions:
(defvar *foo* nil)
(in-package :demo)
(defun thread-fn ()
(format t "Thread ~A running ~%" *current-thread*)
(with-mutex (*a-mutex*)
(format t "Thread ~A got the lock~%" *current-thread*)
(sleep (random 5)))
(format t "Thread ~A dropped lock, dying now~%" *current-thread*))
(make-thread #’thread-fn)
(make-thread #’thread-fn)
sb-thread:mutex [Structure]
Class precedence list: mutex, structure-object, t
Mutex type.
sb-thread:with-mutex (mutex &key wait-p timeout value) &body body [Macro]
Acquire mutex for the dynamic scope of body. If wait-p is true (the default), and the mutex is not
immediately available, sleep until it is available.
If timeout is given, it specifies a relative timeout, in seconds, on how long the system should try to
acquire the lock in the contested case.
If the mutex isn’t acquired successfully due to either wait-p or timeout, the body is not executed, and
with-mutex returns nil.
Otherwise body is executed with the mutex held by current thread, and with-mutex returns the values
of body.
Historically with-mutex also accepted a value argument, which when provided was used as the new
owner of the mutex instead of the current thread. This is no longer supported: if value is provided, it
must be either nil or the current thread.
sb-thread:with-recursive-lock (mutex &key wait-p timeout) &body body [Macro]
Acquire mutex for the dynamic scope of body.
If wait-p is true (the default), and the mutex is not immediately available or held by the current thread,
sleep until it is available.
If timeout is given, it specifies a relative timeout, in seconds, on how long the system should try to
acquire the lock in the contested case.
If the mutex isn’t acquired successfully due to either wait-p or timeout, the body is not executed, and
with-recursive-lock returns nil.
Chapter 13: Threading 102
Otherwise body is executed with the mutex held by current thread, and with-recursive-lock returns
the values of body.
Unlike with-mutex, which signals an error on attempt to re-acquire an already held mutex,
with-recursive-lock allows recursive lock attempts to succeed.
sb-thread:make-mutex &key name [Function]
Create a mutex.
sb-thread:mutex-name instance [Function]
The name of the mutex. Setfable.
sb-thread:mutex-owner mutex [Function]
Current owner of the mutex, nil if the mutex is free. Naturally, this is racy by design (another thread
may acquire the mutex after this function returns), it is intended for informative purposes. For testing
whether the current thread is holding a mutex see holding-mutex-p.
sb-thread:mutex-value mutex [Function]
Current owner of the mutex, nil if the mutex is free. May return a stale value, use mutex-owner instead.
sb-thread:grab-mutex mutex &key waitp timeout [Function]
Acquire mutex for the current thread. If waitp is true (the default) and the mutex is not immediately
available, sleep until it is available.
If timeout is given, it specifies a relative timeout, in seconds, on how long grab-mutex should try to
acquire the lock in the contested case.
If grab-mutex returns t, the lock acquisition was successful. In case of waitp being nil, or an expired
timeout, grab-mutex may also return nil which denotes that grab-mutex did -not- acquire the lock.
Notes:
• grab-mutex is not interrupt safe. The correct way to call it is:
(without-interrupts ... (allow-with-interrupts (grab-mutex ...)) ...)
without-interrupts is necessary to avoid an interrupt unwinding the call while the mutex is in an
inconsistent state while allow-with-interrupts allows the call to be interrupted from sleep.
• (grab-mutex <mutex> :timeout 0.0) differs from (grab-mutex <mutex> :waitp nil) in that the former
may signal a deadline-timeout if the global deadline was due already on entering grab-mutex.
The exact interplay of grab-mutex and deadlines are reserved to change in future versions.
• It is recommended that you use with-mutex instead of calling grab-mutex directly.
sb-thread:release-mutex mutex &key if-not-owner [Function]
Release mutex by setting it to nil. Wake up threads waiting for this mutex.
release-mutex is not interrupt safe: interrupts should be disabled around calls to it.
If the current thread is not the owner of the mutex then it silently returns without doing anything (if
if-not-owner is :punt), signals a warning (if if-not-owner is :warn), or releases the mutex anyway
(if if-not-owner is :force).
13.5 Semaphores
Semaphores are among other things useful for keeping track of a countable resource, e.g. messages in a
queue, and sleep when the resource is exhausted.
sb-thread:semaphore [Structure]
Class precedence list: semaphore, structure-object, t
Semaphore type. The fact that a semaphore is a structure-object should be considered an implemen-
tation detail, and may change in the future.
sb-thread:make-semaphore &key name count [Function]
Create a semaphore with the supplied count and name.
sb-thread:signal-semaphore semaphore &optional n [Function]
Increment the count of semaphore by n. If there are threads waiting on this semaphore, then n of them
is woken up.
Chapter 13: Threading 103
sb-thread:semaphore-notification [Structure]
Class precedence list: semaphore-notification, structure-object, t
Semaphore notification object. Can be passed to wait-on-semaphore and try-semaphore as the
:notification argument. Consequences are undefined if multiple threads are using the same notifi-
cation object in parallel.
sb-thread:make-semaphore-notification [Function]
Constructor for semaphore-notification objects. semaphore-notification-status is initially nil.
(defun reader ()
(with-mutex (*buffer-lock*)
(loop
(condition-wait *buffer-queue* *buffer-lock*)
(loop
(unless *buffer* (return))
(let ((head (car *buffer*)))
(setf *buffer* (cdr *buffer*))
(format t "reader ~A woke, read ~A~%"
*current-thread* head))))))
(defun writer ()
(loop
(sleep (random 5))
(with-mutex (*buffer-lock*)
(let ((el (intern
(string (code-char
(+ (char-code #\A) (random 26)))))))
(setf *buffer* (cons el *buffer*)))
(condition-notify *buffer-queue*))))
(make-thread #’writer)
(make-thread #’reader)
(make-thread #’reader)
sb-thread:waitqueue [Structure]
Class precedence list: waitqueue, structure-object, t
Waitqueue type.
sb-thread:make-waitqueue &key name [Function]
Create a waitqueue.
sb-thread:waitqueue-name instance [Function]
The name of the waitqueue. Setfable.
sb-thread:condition-wait queue mutex &key timeout [Function]
Atomically release mutex and start waiting on queue until another thread wakes us up using either
condition-notify or condition-broadcast on queue, at which point we re-acquire mutex and return
t.
Spurious wakeups are possible.
If timeout is given, it is the maximum number of seconds to wait, including both waiting for the wakeup
and the time to re-acquire mutex. When neither a wakeup nor a re-acquisition occurs within the given
time, returns nil without re-acquiring mutex.
If condition-wait unwinds, it may do so with or without mutex being held.
Important: Since condition-wait may return without condition-notify or condition-broadcast
having occurred, the correct way to write code that uses condition-wait is to loop around the call,
checking the associated data:
(defvar *data* nil)
(defvar *queue* (make-waitqueue))
(defvar *lock* (make-mutex))
;; Consumer
(defun pop-data (&optional timeout)
(with-mutex (*lock*)
Chapter 13: Threading 105
;; Producer
(defun push-data (data)
(with-mutex (*lock*)
(push data *data*)
(condition-notify *queue*)))
13.7 Barriers
These are based on the Linux kernel barrier design, which is in turn based on the Alpha CPU memory
model. They are presently implemented for x86, x86-64, PPC, and ARM64 systems, and behave as compiler
barriers on all other CPUs.
In addition to explicit use of the sb-thread:barrier macro, the following functions and macros also
serve as :memory barriers:
• sb-ext:atomic-decf, sb-ext:atomic-incf, sb-ext:atomic-push, and sb-ext:atomic-pop.
• sb-ext:compare-and-swap.
• sb-thread:grab-mutex, sb-thread:release-mutex, sb-thread:with-mutex and sb-thread:with-
recursive-lock.
• sb-thread:signal-semaphore, sb-thread:try-semaphore and sb-thread:wait-on-semaphore.
• sb-thread:condition-wait, sb-thread:condition-notify and sb-thread:condition-broadcast.
:compiler Prevent the compiler from reordering memory access across the barrier.
:memory Prevent the cpu from reordering any memory access across the barrier.
:read Prevent the cpu from reordering any read access across the barrier.
:write Prevent the cpu from reordering any write access across the barrier.
:data-dependency
Prevent the cpu from reordering dependent memory reads across the barrier (requiring reads
before the barrier to complete before any reads after the barrier that depend on them). This
is a weaker form of the :read barrier.
forms is an implicit progn, evaluated before the barrier. barrier returns the values of the last form in
forms.
The file "memory-barriers.txt" in the Linux kernel documentation is highly recommended reading for
anyone programming at this level.
Chapter 13: Threading 106
13.8 Sessions/Debugging
If the user has multiple views onto the same Lisp image (for example, using multiple terminals, or a windowing
system, or network access) they are typically set up as multiple sessions such that each view has its own
collection of foreground/background/stopped threads. A thread which wishes to create a new session can
use sb-thread:with-new-session to remove itself from the current session (which it shares with its parent
and siblings) and create a fresh one. # See also sb-thread:make-listener-thread.
Within a single session, threads arbitrate between themselves for the user’s attention. A thread may
be in one of three notional states: foreground, background, or stopped. When a background process at-
tempts to print a repl prompt or to enter the debugger, it will stop and print a message saying that it has
stopped. The user at his leisure may switch to that thread to find out what it needs. If a background
thread enters the debugger, selecting any restart will put it back into the background before it resumes.
Arbitration for the input stream is managed by calls to sb-thread:get-foreground (which may block) and
sb-thread:release-foreground.
14 Timers
SBCL supports a system-wide event scheduler implemented on top of setitimer that also works with threads
but does not require a separate scheduler thread.
The following example schedules a timer that writes “Hello, world” after two seconds.
(schedule-timer (make-timer (lambda ()
(write-line "Hello, world")
(force-output)))
2)
It should be noted that writing timer functions requires special care, as the dynamic environment in
which they run is unpredictable: dynamic variable bindings, locks held, etc, all depend on whatever code
was running when the timer fired. The following example should serve as a cautionary tale:
(defvar *foo* nil)
(defun show-foo ()
(format t "~&foo=~S~%" *foo*)
(force-output t))
(defun demo ()
(schedule-timer (make-timer #’show-foo) 0.5)
(schedule-timer (make-timer #’show-foo) 1.5)
(let ((*foo* t))
(sleep 1.0))
(let ((*foo* :surprise!))
(sleep 2.0)))
sb-ext:timer [Structure]
Class precedence list: timer, structure-object, t
Timer type. Do not rely on timers being structs as it may change in future versions.
sb-ext:make-timer function &key name thread [Function]
Create a timer that runs function when triggered.
If a thread is supplied, function is run in that thread. If thread is t, a new thread is created for
function each time the timer is triggered. If thread is nil, function is run in an unspecified thread.
When thread is not t, interrupt-thread is used to run function and the ordering guarantees of
interrupt-thread apply. In that case, function runs with interrupts disabled but with-interrupts
is allowed.
sb-ext:timer-name timer [Function]
Return the name of timer.
sb-ext:timer-scheduled-p timer &key delta [Function]
See if timer will still need to be triggered after delta seconds from now. For timers with a repeat interval
it returns true.
sb-ext:schedule-timer timer time &key repeat-interval absolute-p catch-up [Function]
Schedule timer to be triggered at time. If absolute-p then time is universal time, but non-integral
values are also allowed, else time is measured as the number of seconds from the current time.
If repeat-interval is given, timer is automatically rescheduled upon expiry.
If repeat-interval is non-NIL, the Boolean catch-up controls whether timer will "catch up" by re-
peatedly calling its function without delay in case calls are missed because of a clock discontinuity such
as a suspend and resume cycle of the computer. The default is nil, i.e. do not catch up.
sb-ext:unschedule-timer timer [Function]
Cancel timer. Once this function returns it is guaranteed that timer shall not be triggered again and
there are no unfinished triggers.
108
sb-ext:list-all-timers [Function]
Return a list of all timers in the system.
109
15 Networking
The sb-bsd-sockets module provides a thinly disguised BSD socket API for SBCL. Ideas have been stolen
from the BSD socket API for C and Graham Barr’s IO::Socket classes for Perl.
Sockets are represented as CLOS objects, and the API naming conventions attempt to balance between
the BSD names and good lisp style.
16 Profiling
SBCL includes both a deterministic profiler, that can collect statistics on individual functions, and a more
“modern” statistical profiler.
Inlined functions do not appear in the results reported by either.
(require :sb-sprof)
(defun cpu-test-inner (a i)
(logxor a
(* i 5)
(+ a i)))
Chapter 16: Profiling 114
;;; Take up to 1000 samples of running (CPU-TEST 26), and give a flat
;;; table report at the end. Profiling will end one the body has been
;;; evaluated once, whether or not 1000 samples have been taken.
(sb-sprof:with-profiling (:max-samples 1000
:report :flat
:loop nil)
(cpu-test 26))
;;; Record call counts for functions defined on symbols in the CL-USER
;;; package.
(sb-sprof:profile-call-counts "CL-USER")
;;; Take 1000 samples of running (CPU-TEST 24), and give a flat
;;; table report at the end. The body will be re-evaluated in a loop
;;; until 1000 samples have been taken. A sample count will be printed
;;; after each iteration.
(sb-sprof:with-profiling (:max-samples 1000
:report :flat
:loop t
:show-progress t)
(cpu-test 24))
16.2.2 Output
The flat report format will show a table of all functions that the profiler encountered on the call stack during
sampling, ordered by the number of samples taken while executing that function.
Self Total Cumul
Nr Count % Count % Count % Calls Function
------------------------------------------------------------------------
1 69 24.4 97 34.3 69 24.4 67108864 CPU-TEST-INNER
2 64 22.6 64 22.6 133 47.0 - SB-VM::GENERIC-+
3 39 13.8 256 90.5 172 60.8 1 CPU-TEST
4 31 11.0 31 11.0 203 71.7 - SB-KERNEL:TWO-ARG-XOR
For each function, the table will show three absolute and relative sample counts. The Self column shows
samples taken while directly executing that function. The Total column shows samples taken while executing
Chapter 16: Profiling 115
that function or functions called from it (sampled to a platform-specific depth). The Cumul column shows
the sum of all Self columns up to and including that line in the table.
Additionally the Calls column will record the amount of calls that were made to the function during
the profiling run. This value will only be reported for functions that have been explicitly marked for call
counting with profile-call-counts.
The profiler also hooks into the disassembler such that instructions which have been sampled are an-
notated with their relative frequency of sampling. This information is not stored across different sampling
runs.
; 6CF: 702E JO L4 ; 6/242 samples
; 6D1: D1E3 SHL EBX, 1
; 6D3: 702A JO L4
; 6D5: L2: F6C303 TEST BL, 3 ; 2/242 samples
; 6D8: 756D JNE L8
; 6DA: 8BC3 MOV EAX, EBX ; 5/242 samples
; 6DC: L3: 83F900 CMP ECX, 0 ; 4/242 samples
16.2.4 Macros
16.2.5 Functions
:sort-by <column>
If :samples, sort flat report by number of samples taken. If :cumulative-samples, sort
flat report by cumulative number of samples taken (shows how much time each function
spent on stack.) Default is *report-sort-by*.
:sort-order <order>
If :descending, sort flat report in descending order. If :ascending, sort flat report in
ascending order. Default is *report-sort-order*.
:show-progress <bool>
If true, print progress messages while generating the call graph.
:call-graph <graph>
Print a report from <graph> instead of the latest profiling results.
Value of this function is a call-graph object representing the resulting call-graph, or nil if there are no
samples (eg. right after calling reset.)
Profiling is stopped before the call graph is generated.
sb-sprof:reset [Function]
Reset the profiler.
sb-sprof:start-profiling &key max-samples mode sample-interval alloc-interval [Function]
max-depth threads sampling
Start profiling statistically in the current thread if not already profiling. The following keyword args are
recognized:
:sample-interval <n>
Take a sample every <n> seconds. Default is *sample-interval*.
:alloc-interval <n>
Take a sample every time <n> allocation regions (approximately 8kB) have been allocated
since the last sample. Default is *alloc-interval*.
:mode <mode>
If :cpu, run the profiler in cpu profiling mode. If :alloc, run the profiler in allocation
profiling mode. If :time, run the profiler in wallclock profiling mode.
:max-samples <max>
Maximum number of samples. Default is *max-samples*.
:max-depth <max>
Maximum call stack depth that the profiler should consider. Only has an effect on x86 and
x86-64.
:threads <list>
List threads to profile, or :all to indicate that all threads should be profiled. Defaults to
:all. (Note: with-profiling defaults to the current thread.)
:threads has no effect on call-counting at the moment.
On some platforms (eg. Darwin) the signals used by the profiler are not properly delivered
to threads in proportion to their cpu usage when doing :cpu profiling. If you see empty call
graphs, or are obviously missing several samples from certain threads, you may be falling
afoul of this.
:sampling <bool>
If true, the default, start sampling right away. If false, start-sampling can be used to turn
sampling on.
sb-sprof:stop-profiling [Function]
Stop profiling if profiling.
sb-sprof:profile-call-counts &rest names [Function]
Mark the functions named by names as being subject to call counting during statistical profiling. If a
string is used as a name, it will be interpreted as a package name. In this case call counting will be done
for all functions with names like x or (setf x), where x is a symbol with the package as its home package.
Chapter 16: Profiling 118
sb-sprof:unprofile-call-counts [Function]
Clear all call counting information. Call counting will be done for no functions during statistical profiling.
16.2.6 Variables
sb-sprof:*max-samples* [Variable]
Default number of traces taken. This variable is somewhat misnamed: each trace may actually consist
of an arbitrary number of samples, depending on the depth of the call stack.
sb-sprof:*sample-interval* [Variable]
Default number of seconds between samples.
16.2.7 Credits
sb-sprof is an SBCL port, with enhancements, of Gerd Moellmann’s statistical profiler for CMUCL.
119
17 Contributed Modules
SBCL comes with a number of modules that are not part of the core system. These are loaded via (require
:modulename) (see Section 7.9 [Customization Hooks for Users], page 59). This section contains documen-
tation (or pointers to documentation) for some of the contributed modules.
Chapter 17: Contributed Modules 120
17.1 sb-aclrepl
The sb-aclrepl module offers an Allegro CL-style Read-Eval-Print Loop for SBCL, with integrated inspec-
tor. Adding a debugger interface is planned.
17.1.1 Usage
To start sb-aclrepl as your read-eval-print loop, put the form
(require ’sb-aclrepl)
in your ~/.sbclrc initialization file.
17.1.2 Customization
The following customization variables are available:
sb-aclrepl:*command-char* [Variable]
Prefix character for a top-level command
sb-aclrepl:*prompt* [Variable]
The current prompt string or formatter function.
sb-aclrepl:*exit-on-eof* [Variable]
If t, then exit when the eof character is entered.
sb-aclrepl:*use-short-package-name* [Variable]
when t, use the shortnest package nickname in a prompt
sb-aclrepl:*max-history* [Variable]
Maximum number of history commands to remember
17.1.4 Credits
Allegro CL is a registered trademark of Franz Inc.
Chapter 17: Contributed Modules 121
17.2 sb-concurrency
Additional data structures, synchronization primitives and tools for concurrent programming. Similiar to
Java’s java.util.concurrent package.
Chapter 17: Contributed Modules 122
17.2.1 Queue
sb-concurrency:queue is a lock-free, thread-safe FIFO queue datatype.
The implementation is based on An Optimistic Approach to Lock-Free FIFO Queues by Edya Ladan-Mozes
and Nir Shavit.
Before SBCL 1.0.38, this implementation resided in its own contrib (see Section 17.7 [sb-queue], page 138)
which is still provided for backwards-compatibility but which has since been deprecated.
sb-concurrency:queue [Structure]
Class precedence list: queue, structure-object, t
Lock-free thread safe fifo queue.
Use enqueue to add objects to the queue, and dequeue to remove them.
sb-concurrency:dequeue queue [Function]
Retrieves the oldest value in queue and returns it as the primary value, and t as secondary value. If the
queue is empty, returns nil as both primary and secondary value.
sb-concurrency:enqueue value queue [Function]
Adds value to the end of queue. Returns value.
sb-concurrency:list-queue-contents queue [Function]
Returns the contents of queue as a list without removing them from the queue. Mainly useful for manual
examination of queue state, as the list may be out of date by the time it is returned, and concurrent
dequeue operations may in the worse case force the queue-traversal to be restarted several times.
sb-concurrency:make-queue &key name initial-contents [Function]
Returns a new queue with name and contents of the initial-contents sequence enqueued.
sb-concurrency:queue-count queue [Function]
Returns the number of objects in queue. Mainly useful for manual examination of queue state, and in
print-object methods: inefficient as it must walk the entire queue.
sb-concurrency:queue-empty-p queue [Function]
Returns t if queue is empty, nil otherwise.
sb-concurrency:queue-nameinstance [Function]
Name of a queue. Can be assigned to using setf. Queue names can be arbitrary printable objects, and
need not be unique.
sb-concurrency:queuep object [Function]
Returns true if argument is a queue, nil otherwise.
Chapter 17: Contributed Modules 123
17.2.3 Gates
sb-concurrency:gate is a synchronization object suitable for when multiple threads must wait for a single
event before proceeding.
sb-concurrency:gate [Structure]
Class precedence list: gate, structure-object, t
gate type. Gates are synchronization constructs suitable for making multiple threads wait for single
event before proceeding.
Use wait-on-gate to wait for a gate to open, open-gate to open one, and close-gate to close an open
gate. gate-open-p can be used to test the state of a gate without blocking.
sb-concurrency:close-gate gate [Function]
Closes gate. Returns t if the gate was previously open, and nil if the gate was already closed.
sb-concurrency:gate-name instance [Function]
Name of a gate. SETFable.
sb-concurrency:gate-open-p gate [Function]
Returns true if gate is open.
sb-concurrency:gatep object [Function]
Returns true if the argument is a gate.
sb-concurrency:make-gate &key name open [Function]
Makes a new gate. Gate will be initially open if open is true, and closed if open is nil (the default.)
name, if provided, is the name of the gate, used when printing the gate.
sb-concurrency:open-gategate [Function]
Opens gate. Returns t if the gate was previously closed, and nil if the gate was already open.
sb-concurrency:wait-on-gate gate &key timeout [Function]
Waits for gate to open, or timeout seconds to pass. Returns t if the gate was opened in time, and nil
otherwise.
Chapter 17: Contributed Modules 125
sb-concurrency:frlock [Structure]
Class precedence list: frlock, structure-object, t
FRlock, aka Fast Read Lock.
Fast Read Locks allow multiple readers and one potential writer to operate in parallel while providing
for consistency for readers and mutual exclusion for writers.
Readers gain entry to protected regions without waiting, but need to retry if a writer operated inside the
region while they were reading. This makes frlocks very efficient when readers are much more common
than writers.
FRlocks are not suitable when it is not safe at all for readers and writers to operate on the same data
in parallel: they provide consistency, not exclusion between readers and writers. Hence using an frlock
to eg. protect an sbcl hash-table is unsafe. If multiple readers operating in parallel with a writer would
be safe but inconsistent without a lock, frlocks are suitable.
The recommended interface to use is frlock-read and frlock-write, but those needing it can also use
a lower-level interface.
Example:
;; Values returned by FOO are always consistent so that
;; the third value is the sum of the two first ones.
(let ((a 0)
(b 0)
(c 0)
(lk (make-frlock)))
(defun foo ()
(frlock-read (lk) a b c))
(defun bar (x y)
(frlock-write (lk)
(setf a x
b y
c (+ x y)))))
sb-concurrency:frlock-read (frlock) &body value-forms [Macro]
Evaluates value-forms under frlock till it obtains a consistent set, and returns that as multiple values.
sb-concurrency:frlock-write (frlock &key wait-p timeout) &body body [Macro]
Executes body while holding frlock for writing.
sb-concurrency:make-frlock &key name [Function]
Returns a new frlock with name.
sb-concurrency:frlock-name instance [Function]
Name of an frlock. SETFable.
sb-concurrency:frlock-read-begin frlock [Function]
Start a read sequence on frlock. Returns a read-token and an epoch to be validated later.
Using frlock-read instead is recommended.
sb-concurrency:frlock-read-end frlock [Function]
Ends a read sequence on frlock. Returns a token and an epoch. If the token and epoch are eql to the
read-token and epoch returned by frlock-read-begin, the values read under the frlock are consistent
and can be used: if the values differ, the values are inconsistent and the read must be restated.
Using frlock-read instead is recommended.
Example:
(multiple-value-bind (t0 e0) (frlock-read-begin *fr*)
(let ((a (get-a))
(b (get-b)))
(multiple-value-bind (t1 e1) (frlock-read-end *fr*)
(if (and (eql t0 t1) (eql e0 e1))
(list :a a :b b)
:aborted))))
Chapter 17: Contributed Modules 126
17.3 sb-cover
The sb-cover module provides a code coverage tool for SBCL. The tool has support for expression coverage,
and for some branch coverage. Coverage reports are only generated for code compiled using compile-file
with the value of the sb-cover:store-coverage-data optimization quality set to 3.
As of SBCL 1.0.6 sb-cover is still experimental, and the interfaces documented here might change in
later versions.
;;; Load some code, ensuring that it’s recompiled with the new optimization
;;; policy.
(asdf:oos ’asdf:load-op :cl-ppcre-test :force t)
17.3.2 Functions
17.4 sb-grovel
The sb-grovel module helps in generation of foreign function interfaces. It aids in extracting constants’
values from the C compiler and in generating SB-ALIEN structure and union types, see Section 9.2.1 [Defining
Foreign Types], page 71.
The ASDF(http://www.cliki.net/ASDF) component type GROVEL-CONSTANTS-FILE has its PER-
FORM operation defined to write out a C source file, compile it, and run it. The output from this program
is Lisp, which is then itself compiled and loaded.
sb-grovel is used in a few contributed modules, and it is currently compatible only to SBCL. However, if
you want to use it, here are a few directions.
(defpackage :example-package.system
(:use :cl :asdf :sb-grovel :sb-alien))
(in-package :example-package.system)
(defsystem example-system
:depends-on (sb-grovel)
:components
((:module "sbcl"
:components
((:file "defpackage")
(grovel-constants-file "example-constants"
:package :example-package)))))
Make sure to specify the package you chose in step 1
5. Build stuff.
definitions don’t use any information from the C program; they expand directly to sb-alien:define-
alien-routine (see Section 9.7.2 [The define-alien-routine Macro], page 78) forms.
Here’s how to use the grovel clauses:
• :integer - constant expressions in C. Used in this form:
(:integer lisp-variable-name "C expression" &optional doc export)
"C expression" will be typically be the name of a constant. But other forms are possible.
• :enum
(:enum lisp-type-name ((lisp-enumerated-name c-enumerated-name) ...)))
An sb-alien:enum type with name lisp-type-name will be defined. The symbols are the
lisp-enumerated-names, and the values are grovelled from the c-enumerated-names.
• :structure - alien structure definitions look like this:
(:structure lisp-struct-name ("struct c_structure"
(type-designator lisp-element-name
"c_element_type" "c_element_name"
:distrust-length nil)
; ...
))
type-designator is a reference to a type whose size (and type constraints) will be groveled for. sb-
grovel accepts a form of type designator that doesn’t quite conform to either lisp nor sb-alien’s type
specifiers. Here’s a list of type designators that sb-grovel currently accepts:
• integer - a C integral type; sb-grovel will infer the exact type from size information extracted
from the C program. All common C integer types can be grovelled for with this type designator,
but it is not possible to grovel for bit fields yet.
• (unsigned n) - an unsigned integer variable that is n bytes long. No size information from the C
program will be used.
• (signed n) - an signed integer variable that is n bytes long. No size information from the C
program will be used.
• c-string - an array of char in the structure. sb-grovel will use the array’s length from the C
program, unless you pass it the :distrust-length keyword argument with non-nil value (this
might be required for structures such as solaris’s struct dirent).
• c-string-pointer - a pointer to a C string, corresponding to the sb-alien:c-string type (see
Section 9.2.3 [Foreign Type Specifiers], page 72).
• (array alien-type) - An array of the previously-declared alien type. The array’s size will be
determined from the output of the C program and the alien type’s size.
• (array alien-type n) - An array of the previously-declared alien type. The array’s size will be
assumed as being n.
Note that c-string and c-string-pointer do not have the same meaning. If you declare that an
element is of type c-string, it will be treated as if the string is a part of the structure, whereas if
you declare that the element is of type c-string-pointer, a pointer to a string will be the structure
member.
• :function - alien function definitions are similar to define-alien-routine definitions, because they
expand to such forms when the lisp program is loaded. See Section 9.7 [Foreign Function Calls], page 78.
(:function lisp-function-name ("alien_function_name" alien-return-type
(argument alien-type)
(argument2 alien-type)))
17.5 sb-md5
The sb-md5 module implements the RFC1321 MD5 Message Digest Algorithm. [FIXME cite]
sb-md5:md5sum-file pathname [Function]
Calculate the MD5 message-digest of the file specified by ‘pathname’.
sb-md5:md5sum-sequence sequence &key start end [Function]
Calculate the MD5 message-digest of data in ‘sequence’, which should be a 1d simple-array with element
type (unsigned-byte 8). On cmu cl and sbcl non-simple and non-1d arrays with this element-type are
also supported. Use with strings is deprecated, since this will not work correctly on implementations
with ‘char-code-limit’ > 256 and ignores character-coding issues. Use md5sum-string instead, or convert
to the required (unsigned-byte 8) format through other means before-hand.
sb-md5:md5sum-stream stream [Function]
Calculate an MD5 message-digest of the contents of ‘stream’. Its element-type has to be (unsigned-byte
8). Use on character streams is deprecated, as this will not work correctly on implementations with
‘char-code-limit’ > 256 and ignores character coding issues.
sb-md5:md5sum-string string &key external-format start end [Function]
Calculate the MD5 message-digest of the binary representation of ‘string’ (as octets) in the external
format specified by ‘external-format’. The boundaries ‘start’ and ‘end’ refer to character positions in the
string, not to octets in the resulting binary representation. The permissible external format specifiers are
determined by the underlying implementation.
17.5.1 Credits
The implementation for CMUCL was largely done by Pierre Mai, with help from members of the cmucl-help
mailing list. Since CMUCL and SBCL are similar in many respects, it was not too difficult to extend the
low-level implementation optimizations for CMUCL to SBCL. Following this, SBCL’s compiler was extended
to implement efficient compilation of modular arithmetic (see Section 6.3 [Modular arithmetic], page 39),
which enabled the implementation to be expressed in portable arithmetical terms, apart from the use of
rotate-byte for bitwise rotation.
Chapter 17: Contributed Modules 133
17.6 sb-posix
Sb-posix is the supported interface for calling out to the operating system.1
The scope of this interface is “operating system calls on a typical Unixlike platform”. This is section 2 of
the Unix manual, plus section 3 calls that are (a) typically found in libc, but (b) not part of the C standard.
For example, we intend to provide support for opendir() and readdir(), but not for printf(). That said,
if your favourite system call is not included yet, you are encouraged to submit a patch to the SBCL mailing
list.
Some facilities are omitted where they offer absolutely no additional use over some portable function, or
would be actively dangerous to the consistency of Lisp. Not all functions are available on all platforms.
17.6.2 Types
Generally, marshalling between Lisp and C data types is done using SBCL’s FFI. See Chapter 9 [Foreign
Function Interface], page 71.
Some functions accept objects such as filenames or file descriptors. In the C binding to POSIX these are
represented as strings and small integers respectively. For the Lisp programmer’s convenience we introduce
designators such that CL pathnames or open streams can be passed to these functions. For example, rename
accepts both pathnames and strings as its arguments.
17.6.2.1 File-descriptors
sb-posix:file-descriptor [Type]
A fixnum designating a native file descriptor.
sb-sys:make-fd-stream can be used to construct a file-stream associated with a native file descriptor.
Note that mixing I/O operations on a file-stream with operations directly on its descriptor may produce
unexpected results if the stream is buffered.
sb-posix:file-descriptor-designator [Type]
Designator for a file-descriptor: either a fixnum designating itself, or a file-stream designating the
underlying file-descriptor.
sb-posix:file-descriptor file-descriptor [Function]
Converts file-descriptor-designator into a file-descriptor.
17.6.2.2 Filenames
sb-posix:filename [Type]
A string designating a filename in native namestring syntax.
Note that native namestring syntax is distinct from Lisp namestring syntax:
(pathname "/foo*/bar")
is a wild pathname with a pattern-matching directory component. sb-ext:parse-native-namestring
may be used to construct Lisp pathnames that denote posix filenames as understood by system calls, and
sb-ext:native-namestring can be used to coerce them into strings in the native namestring syntax.
1
The functionality contained in the package SB-UNIX is for SBCL internal use only; its contents are likely to change
from version to version.
Chapter 17: Contributed Modules 134
Note also that posix filename syntax does not distinguish the names of files from the names of directories:
in order to parse the name of a directory in posix filename syntax into a pathname my-defaults for
which
(merge-pathnames (make-pathname :name "FOO" :case :common)
my-defaults)
returns a pathname that denotes a file in the directory, supply a true :as-directory argument to
sb-ext:parse-native-namestring. Likewise, to supply the name of a directory to a posix function in
non-directory syntax, supply a true :as-file argument to sb-ext:native-namestring.
sb-posix:filename-designator [Type]
Designator for a filename: a string designating itself, or a designator for a pathname designating the
corresponding native namestring.
sb-posix:filename filename [Function]
Converts filename-designator into a filename.
sb-posix:flock [Class]
Class precedence list: flock, standard-object, t
Chapter 17: Contributed Modules 135
Slots:
• type — initarg: :type; reader: sb-posix:flock-type; writer: (setf sb-posix:flock-type)
Type of lock; F RDLCK, F WRLCK, F UNLCK.
• whence — initarg: :whence; reader: sb-posix:flock-whence; writer:
(setf sb-posix:flock-whence)
Flag for starting offset.
• start — initarg: :start; reader: sb-posix:flock-start; writer:
(setf sb-posix:flock-start)
Relative offset in bytes.
• len — initarg: :len; reader: sb-posix:flock-len; writer: (setf sb-posix:flock-len)
Size; if 0 then until eof.
• pid — reader: sb-posix:flock-pid
Process id of the process holding the lock; returned with F GETLK.
Class representing locks used in fcntl(2).
• passwd
sb-posix:passwd [Class]
Class precedence list: passwd, standard-object, t
Slots:
• name — initarg: :name; reader: sb-posix:passwd-name; writer:
(setf sb-posix:passwd-name)
User’s login name.
• passwd — initarg: :passwd; reader: sb-posix:passwd-passwd; writer:
(setf sb-posix:passwd-passwd)
The account’s encrypted password.
• uid — initarg: :uid; reader: sb-posix:passwd-uid; writer: (setf sb-posix:passwd-uid)
Numerical user id.
• gid — initarg: :gid; reader: sb-posix:passwd-gid; writer: (setf sb-posix:passwd-gid)
Numerical group id.
• gecos — initarg: :gecos; reader: sb-posix:passwd-gecos; writer:
(setf sb-posix:passwd-gecos)
User’s name or comment field.
• dir — initarg: :dir; reader: sb-posix:passwd-dir; writer: (setf sb-posix:passwd-dir)
Initial working directory.
• shell — initarg: :shell; reader: sb-posix:passwd-shell; writer:
(setf sb-posix:passwd-shell)
Program to use as shell.
Instances of this class represent entries in the system’s user database.
• stat
sb-posix:stat [Class]
Class precedence list: stat, standard-object, t
Slots:
• mode — initarg: :mode; reader: sb-posix:stat-mode
Mode of file.
• ino — initarg: :ino; reader: sb-posix:stat-ino
File serial number.
• dev — initarg: :dev; reader: sb-posix:stat-dev
Device id of device containing file.
Chapter 17: Contributed Modules 136
sb-posix:getcwd [Function]
Returns the process’s current working directory as a string.
• readlink
17.7 sb-queue
Since SBCL 1.0.38, the sb-queue module has been merged into the sb-concurrency module (see Section 17.2
[sb-concurrency], page 121.)
Chapter 17: Contributed Modules 139
17.8 sb-rotate-byte
The sb-rotate-byte module offers an interface to bitwise rotation, with an efficient implementation for
operations which can be performed directly using the platform’s arithmetic routines. It implements the
specification at http://www.cliki.net/ROTATE-BYTE.
Bitwise rotation is a component of various cryptographic or hashing algorithms: MD5, SHA-1, etc.; often
these algorithms are specified on 32-bit rings. [FIXME cite cite cite].
sb-rotate-byte:rotate-byte count bytespec integer [Function]
Rotates a field of bits within integer; specifically, returns an integer that contains the bits of integer
rotated count times leftwards within the byte specified by bytespec, and elsewhere contains the bits of
integer.
140
18 Deprecation
In order to support evolution of interfaces in SBCL as well as in user code, SBCL allows declaring functions,
variables and types as deprecated. Users of deprecated things are notified by means of warnings while the
deprecated thing in question is still available.
This chapter documents the interfaces for being notified when using deprecated thing and declaring things
as deprecated, the deprecation process used for SBCL interfaces, and lists legacy interfaces in various stages
of deprecation.
Deprecation in this context should not be confused with those things the ANSI Common Lisp standard
calls deprecated: the entirety of ANSI CL is supported by SBCL, and none of those interfaces are subject
to censure.
of increasing severity are signaled, which note that the interface is deprecated, and point users towards any
replacements when applicable.
1. Early Deprecation
During early deprecation the interface is kept in working condition. However, when a thing in this
deprecation stage is used, an sb-ext:early-deprecation-warning, which is a style-warning, is
signaled at compile-time.
The internals may change at this stage: typically because the interface is re-implemented on top of its
successor. While we try to keep things as backwards-compatible as feasible (taking maintenance costs
into account), sometimes semantics change slightly.
For example, when the spinlock API was deprecated, spinlock objects ceased to exist, and the whole
spinlock API became a synonym for the mutex API – so code using the spinlock API continued working,
but silently switched to mutexes instead. However, if someone relied on
(typep lock ’spinlock)
returning NIL for a mutexes, trouble could ensue.
2. Late Deprecation
During late deprecation the interface remains as it was during early deprecation, but the compile-time
warning is upgraded: when a thing in this deprecation stage is used, a sb-ext:late-deprecation-
warning, which is a full warning, is signaled at compile-time.
3. Final Deprecation
During final deprecation the symbols still exist. However, when a thing in this deprecation stage is
used, a sb-ext:final-deprecation-warning, which is a full warning, is signaled at compile-time and
an error is signaled at run-time.
4. After Final Deprecation
The interface is deleted entirely.
sb-ext:deprecation-condition [Condition]
Class precedence list: deprecation-condition, condition, t
Superclass for deprecation-related error and warning conditions.
sb-ext:early-deprecation-warning [Condition]
Class precedence list: early-deprecation-warning, style-warning, warning,
deprecation-condition, condition, t
This warning is signaled when the use of a variable, function, type, etc. in :early deprecation is detected
at compile-time. The use will work at run-time with no warning or error.
sb-ext:late-deprecation-warning [Condition]
Class precedence list: late-deprecation-warning, warning, deprecation-condition, condition, t
This warning is signaled when the use of a variable, function, type, etc. in :late deprecation is detected
at compile-time. The use will work at run-time with no warning or error.
sb-ext:final-deprecation-warning [Condition]
Class precedence list: final-deprecation-warning, warning, deprecation-condition, condition, t
This warning is signaled when the use of a variable, function, type, etc. in :final deprecation is detected
at compile-time. An error will be signaled at run-time.
sb-ext:deprecation-error [Condition]
Class precedence list: deprecation-error, error, serious-condition, deprecation-condition,
condition, t
This error is signaled at run-time when an attempt is made to use a thing that is in :final deprecation,
i.e. call a function or access a variable.
Chapter 18: Deprecation 142
sb-ext:deprecated [Declaration]
Syntax:
sb-ext:deprecated stage since {object-clause}*
=> BAZ
(baz)
=> NIL ; no error
(defun danger ()
(fez))
| WARNING: The function CL-USER::FEZ has been deprecated...
=> DANGER
(danger)
|- ERROR: The function CL-USER::FEZ has been deprecated...
• SB-UNIX:UNIX-EXIT
Deprecated as of 1.0.56.55 in May 2012. Expected to move into late deprecation in May 2013.
When the SBCL process termination was refactored as part of changes that led to sb-ext:quit being
deprecated, sb-unix:unix-exit ceased to be used internally. Since SB-UNIX is an internal package
not intended for user code to use, and since we’re slowly in the process of refactoring things to be less
Unix-oriented, sb-unix:unix-exit was initially deleted as it was no longer used. Unfortunately it
became apparent that it was used by several external users, so it was re-instated in deprecated form.
While the cost of keeping sb-unix:unix-exit indefinitely is trivial, the ability to refactor our internals
is important, so its deprecation was taken as an opportunity to highlight that SB-UNIX is an internal
package and SB-POSIX should be used by user-programs instead – or alternatively calling the foreign
function directly if the desired interface doesn’t for some reason exist in SB-POSIX.
Remedy
For code needing to work with legacy SBCLs, use e.g. system-exit as show above in remedies for
sb-ext:quit. In modern SBCLs simply call either sb-posix:exit or sb-ext:exit with appropriate
arguments.
• Spinlock API
Deprecated as of 1.0.53.11 in August 2011. Expected to move into late deprecation in August 2012.
Spinlocks were an internal interface, but had a number of external users and were hence deprecated
instead of being simply deleted.
Chapter 18: Deprecation 144
• SB-INTROSPECT:FUNCTION-ARGLIST
Deprecated in favor of sb-introspect:function-lambda-list as of 1.0.24.5 in January 2009. Ex-
pected to move into final deprecation in January 2012.
Renamed for consistency and aesthetics. Functions have lambda-lists, not arglists.
Remedy
For code that needs to support legacy SBCLs, use e.g.:
However, unless stack allocation is essential, we recommend simply removing these declarations. Refer
to documentation on sb-ext:*stack-allocate-dynamic* for details on stack allocation control in
modern SBCLs.
• SB-SYS:OUTPUT-RAW-BYTES
Deprecated as of 1.0.8.16 in June 2007. Expected to move into final deprecation in June 2012.
Internal interface with some external users. Never officially supported, deemed unnecessary in presence
of write-sequence and bivalent streams.
Remedy
Use streams with element-type (unsigned-byte 8) or :default – the latter allowing both binary and
character IO – in conjunction with write-sequence.
A F
Actual Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17, 18 Fast Read Lock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Arithmetic, hardware . . . . . . . . . . . . . . . . . . . . . . . . . . 39, 139 Finalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Arithmetic, modular . . . . . . . . . . . . . . . . . . . . . . . . . . . 39, 139 Foreign Function Interface, generation . . . . . . . . . . . . . 129
Asynchronous Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 freeze-type declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Availability of debug variables . . . . . . . . . . . . . . . . . . . . . . 30 Frlock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Function, tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
B G
Block compilation, debugger implications . . . . . . . . . . . 28 Garbage collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Block, basic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Garbage Collection, conservative . . . . . . . . . . . . . . . . . . . . 8
Block, start location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Garbage Collection, generational . . . . . . . . . . . . . . . . . . . . 8
Gate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
C
Character Coding Conditions . . . . . . . . . . . . . . . . . . . . . . . 68 H
Character Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Hash tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Cleanup, stack frame kind . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Hashing, cryptographic. . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Code Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Compatibility with other Lisps . . . . . . . . . . . . . . . . . . . . . 20
Compile time type errors . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 I
Compiler Diagnostic Severity . . . . . . . . . . . . . . . . . . . . . . . 16 Inline expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24, 32
Compiler messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Interning Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Interpreter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Converting between Strings and Octet Vectors . . . . . . 68 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Introspecting Deprecation Information. . . . . . . . . . . . . 142
D L
Deadline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
ldb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2, 12
Debug optimization quality . . . . . . . . . . . . . . . . . . . . . 30, 32
ldb, disabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12, 36
Debug variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
ldb, enabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Locations, unknown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
debugger, disabling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Logical pathnames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
debugger, enabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Decimal Syntax for Rationals. . . . . . . . . . . . . . . . . . . . . . . 42
declaration, dynamic-extent . . . . . . . . . . . . . . . . . . . . . . . 37 M
Declaration, freeze-type . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Macroexpansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Macroexpansion, errors during . . . . . . . . . . . . . . . . . . . . . 24
Deprecation Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Mailbox, lock-free . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Deprecation Declaration. . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Messages, Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Deprecation Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Modular arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39, 139
disabling debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
disabling ldb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12, 36
dynamic-extent declaration . . . . . . . . . . . . . . . . . . . . . . . . 37 N
Name, of character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
NFKC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
E Nicknames, Package-local . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Efficiency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Normalization, String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Entry points, external . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Normalization, Symbol Name. . . . . . . . . . . . . . . . . . . . . . . 42
Errors, run-time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Existing programs, to run . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Extended Package Prefix Syntax . . . . . . . . . . . . . . . . . . . 42 O
External entry points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Open-coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
External Format Designators . . . . . . . . . . . . . . . . . . . . . . . 67 Operating System Interface . . . . . . . . . . . . . . . . . . . . . . . 133
External formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 optimization quality, safety. . . . . . . . . . . . . . . . . . . . . . . . 38
External, stack frame kind . . . . . . . . . . . . . . . . . . . . . . . . . 28 Optimize declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Optional, stack frame kind . . . . . . . . . . . . . . . . . . . . . . . . . 28
Original Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17, 18
Appendix A: Concept Index 147
P Source-to-source transformation . . . . . . . . . . . . . . . . . . . . 18
Package Locks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Stack frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Package Prefix Syntax, extended . . . . . . . . . . . . . . . . . . . 42 Static functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Package-Local Nicknames . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Stepper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Packages, locked . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Stream External formats . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Pathnames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Supported External Formats . . . . . . . . . . . . . . . . . . . . . . . 68
Pathnames, logical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Symbol Name Normalization . . . . . . . . . . . . . . . . . . . . . . . 42
Policy, debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Symbols, interning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Posix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Synchronous Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Precise type checking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 System Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Processing Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17, 18
Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Profiling, deterministic . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Profiling, statistical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 T
Tail recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
The Default External Format. . . . . . . . . . . . . . . . . . . . . . . 67
Q
The Deprecation Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . 140
Queue, FIFO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63, 64
Queue, lock-free . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Type checking, at compile time . . . . . . . . . . . . . . . . . . . . . 23
R Type checking, precise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Types, portability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Random Number Generation . . . . . . . . . . . . . . . . . . . . . . . 61
Rational, decimal syntax for . . . . . . . . . . . . . . . . . . . . . . . . 42
Read errors, compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Read-Eval-Print Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 U
Reader Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Recursion, tail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Unicode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42, 55
REPL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Unknown code locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
S
V
Safety optimization quality . . . . . . . . . . . . . . . . . . . . . 19, 38
safety optimization quality . . . . . . . . . . . . . . . . . . . . . . . . 38 Validity of debug variables . . . . . . . . . . . . . . . . . . . . . . . . . 30
Sb-concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Variables, debugger access . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Semi-inline expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Severity of compiler messages . . . . . . . . . . . . . . . . . . . . . . 16
Single Stepping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Slot access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
W
Sockets, Networking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 Weak pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Source location printing, debugger . . . . . . . . . . . . . . . . . . 31 Why Deprecate? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
148
? cl:cons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 continue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
copy function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
cl:copy-seq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
A
abort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
sb-thread:abort-thread . . . . . . . . . . . . . . . . . . . . . . . . . 96 D
sb-ext:add-implementation-package . . . . . . . . . 94
sb-ext:add-package-local-nickname . . . . . . . . . 43 sb-unicode:decimal-value . . . . . . . . . . . . . . . . . . . . . . . . 56
sb-alien:addr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 cl:declare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
sb-sequence:adjust-sequence . . . . . . . . . . . . . . . . . . . . . . 50 sb-unicode:default-ignorable-p . . . . . . . . . . . . . . . . . 57
sb-unicode:age . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 sb-ext:defcas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
sb-alien:alien-funcall . . . . . . . . . . . . . . . . . . . . . . . . 78 cl:defclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
sb-alien:alien-sap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 cl:defconstant . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
sb-unicode:alphabetic-p . . . . . . . . . . . . . . . . . . . . . . . . . 57 sb-ext:defglobal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
sb-ext:always-bound . . . . . . . . . . . . . . . . . . . . . . . . . 40 sb-alien:define-alien-routine . . . . . . . . . . . . . . . . 78
cl:apropos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 sb-alien:define-alien-variable . . . . . . . . . . . . . . . 76
sb-ext:array-storage-vector . . . . . . . . . . . . . . . . 65 sb-ext:define-cas-expander . . . . . . . . . . . . . . . . 100
sb-ext:assert-version->= . . . . . . . . . . . . . . . . . . . . 65 sb-ext:define-hash-table-test . . . . . . . . . . . . . . 60
sb-ext:atomic-decf. . . . . . . . . . . . . . . . . . . . . . . . . . . 98 cl:defmethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
sb-ext:atomic-incf. . . . . . . . . . . . . . . . . . . . . . . . . . . 98 cl:defpackage . . . . . . . . . . . . . . . . . . . . 42, 91, 94
sb-ext:atomic-pop . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 cl:defstruct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
sb-ext:atomic-push. . . . . . . . . . . . . . . . . . . . . . . . . . . 99 sb-ext:delete-directory . . . . . . . . . . . . . . . . . . . . . 65
sb-ext:atomic-update . . . . . . . . . . . . . . . . . . . . . . . . 99
sb-ext:deprecated. . . . . . . . . . . . . . . . . . . . . . . . . . . 142
sb-concurrency:dequeue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
B sb-alien:deref . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
describe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
backtrace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
sb-ext:describe-compiler-policy . . . . . . . . . . . . 22
sb-thread:barrier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
sb-unicode:digit-value. . . . . . . . . . . . . . . . . . . . . . . . . . . 56
sb-unicode:bidi-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
sb-unicode:bidi-mirroring-glyph . . . . . . . . . . . . . . . . 56 sb-ext:disable-debugger . . . . . . . . . . . . . . . . . . . . . 36
cl:both-case-p. . . . . . . . . . . . . . . . . . . . . . . . . . . 58 sb-ext:disable-package-locks . . . . . . . . . . . 91, 93
bottom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 cl:dolist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
sb-ext:bytes-consed-between-gcs . . . . . . . . . . . . 45 sb-sequence:dosequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
sb-ext:dynamic-space-size . . . . . . . . . . . . . . . . . . 45
C
sb-ext:cancel-finalization . . . . . . . . . . . . . . . . . 45
sb-ext:cas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
E
sb-unicode:case-ignorable-p . . . . . . . . . . . . . . . . . . . . . 57
sb-unicode:cased-p . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 sb-unicode:east-asian-width . . . . . . . . . . . . . . . . . . . . . 56
sb-unicode:casefold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 cl:ed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
sb-alien:cast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 element function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
sb-unicode:char-block . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 sb-sequence:elt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
cl:char-downcase . . . . . . . . . . . . . . . . . . . . . . . . 58 sb-sequence:emptyp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
cl:char-name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 sb-ext:enable-debugger . . . . . . . . . . . . . . . . . . . . . . 36
cl:class-name . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 sb-ext:enable-package-locks. . . . . . . . . . . . . 91, 93
cl:class-of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 endp function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
sb-mop:class-prototype . . . . . . . . . . . . . . . . . . . . . . 48 sb-concurrency:enqueue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
sb-cover:clear-coverage . . . . . . . . . . . . . . . . . . . . . . 127 sb-mop:ensure-class . . . . . . . . . . . . . . . . . . . . . . . . . 49
sb-thread:clear-semaphore-notification . . . . . . 103 sb-mop:ensure-class-using-class . . . . . . . . . . . . 49
cl:close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 cl:ensure-generic-function . . . . . . . . . . . . . 48
sb-concurrency:close-gate. . . . . . . . . . . . . . . . . . . . . . . . . . . 124 error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
cl:coerce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 cl:eval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
sb-unicode:combining-class . . . . . . . . . . . . . . . . . . . . . . 56
sb-ext:exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
sb-ext:compare-and-swap . . . . . . . . . . . . . . . . . . . . . 99
cl:expt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
sb-mop:compute-effective-method . . . . . . . . . . . . 47
sb-alien:extern-alien . . . . . . . . . . . . . . . . . . . . . . . . . 76
sb-sequence:concatenate. . . . . . . . . . . . . . . . . . . . . . . . . . . 51
sb-thread:condition-broadcast . . . . . . . . . . . . . . . . 105
sb-thread:condition-notify . . . . . . . . . . . . . . . . . . . . 105
sb-thread:condition-wait . . . . . . . . . . . . . . . . . . . . . . 104
sb-unicode:confusable-p . . . . . . . . . . . . . . . . . . . . . . . . . 58
Appendix B: Function Index 149
F I
sb-posix:file-descriptor . . . . . . . . . . . . . . . . . . . . . 133 sb-unicode:ideographic-p . . . . . . . . . . . . . . . . . . . . . . . . 57
sb-posix:filename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 index function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
sb-ext:finalize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 cl:inspect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
sb-mop:finalize-inheritance . . . . . . . . . . . . . . . . 48 sb-sys:int-sap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
cl:find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 cl:intern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
cl:find-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 sb-mop:intern-eql-specializer . . . . . . . . . . . . . . 49
cl:find-method. . . . . . . . . . . . . . . . . . . . . . . . . . . 49 sb-thread:interrupt-thread . . . . . . . . . . . . . . . . . . . . . 96
cl:find-package . . . . . . . . . . . . . . . . . . . . . . . . . 42 sb-sequence:iterator-copy . . . . . . . . . . . . . . . . . . . . . . . . 53
cl:find-symbol. . . . . . . . . . . . . . . . . . . . . . . . . . . 42 sb-sequence:iterator-element . . . . . . . . . . . . . . . . . 52, 53
cl:flet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38, 91 sb-sequence:iterator-endp . . . . . . . . . . . . . . . . . . . . . . . . 52
sb-ext:float-denormalized-p . . . . . . . . . . . . . . . . 65 sb-sequence:iterator-index . . . . . . . . . . . . . . . . . . . . . . . 53
frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 sb-sequence:iterator-step . . . . . . . . . . . . . . . . . . . . . . . . 52
sb-alien:free-alien . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
sb-concurrency:frlock-name . . . . . . . . . . . . . . . . . . . . . . . . . 125
sb-concurrency:frlock-read . . . . . . . . . . . . . . . . . . . . . . . . . 125
J
sb-concurrency:frlock-read-begin. . . . . . . . . . . . . . . . . . . 125 sb-thread:join-thread . . . . . . . . . . . . . . . . . . . . . . . 63, 96
sb-concurrency:frlock-read-end . . . . . . . . . . . . . . . . . . . . . 125
sb-concurrency:frlock-write . . . . . . . . . . . . . . . . . . . . . . . . 125
sb-mop:funcallable-standard- L
instance-access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 cl:labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38, 91
sb-sequence:length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
cl:let . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40, 91
G cl:let* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40, 91
sb-unicode:line-break-class . . . . . . . . . . . . . . . . . . . . . 57
sb-concurrency:gate-name . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
sb-unicode:lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
sb-concurrency:gate-open-p . . . . . . . . . . . . . . . . . . . . . . . . . 124
cl:list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
sb-concurrency:gatep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
cl:list* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
sb-ext:gc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
sb-thread:list-all-threads . . . . . . . . . . . . . . . . . . . . . 95
sb-ext:gc-logfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 sb-ext:list-all-timers . . . . . . . . . . . . . . . . . . . . . 108
sb-unicode:general-category . . . . . . . . . . . . . . . . . . . . . 55 list-locals. . . . . . . . . . . . . . . . . . . . . . . . . . . 29
sb-ext:generation-average-age . . . . . . . . . . . . . . 45 sb-concurrency:list-mailbox-messages . . . . . . . . . . . . . . 123
sb-ext:generation-bytes-allocated . . . . . . . . . 46 sb-concurrency:list-queue-contents . . . . . . . . . . . . . . . . 122
sb-ext:generation-bytes- sb-alien:load-shared-object . . . . . . . . . . . . . . . . . . 77
consed-between-gcs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 sb-ext:lock-package . . . . . . . . . . . . . . . . . . . . . . . . . 94
sb-ext:generation-minimum-age-before-gc . . 46 cl:logand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
sb-ext:generation-number-of-gcs . . . . . . . . . . . . 46 cl:logical-pathname-translations . . . . . . 82
sb-ext:generation-number-of-gcs- sb-unicode:lowercase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
before-promotion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 sb-unicode:lowercase-p. . . . . . . . . . . . . . . . . . . . . . . . . . . 56
sb-mop:generic-function-declarations . . . . . . 48
sb-ext:get-bytes-consed . . . . . . . . . . . . . . . . . . . . . 45
sb-ext:get-cas-expansion. . . . . . . . . . . . . . . . . . . 100 M
sb-alien:get-errno . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 cl:macrolet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
sb-bsd-sockets:get-host-by-address . . . . . . . . . . . . . . . . 112 sb-concurrency:mailbox-count . . . . . . . . . . . . . . . . . . . . . . . 123
sb-bsd-sockets:get-host-by-name . . . . . . . . . . . . . . . . . . . . 112 sb-concurrency:mailbox-empty-p . . . . . . . . . . . . . . . . . . . . . 123
sb-bsd-sockets:get-protocol-by-name . . . . . . . . . . . . . . . 112 sb-concurrency:mailbox-name . . . . . . . . . . . . . . . . . . . . . . . . 123
sb-ext:get-time-of-day . . . . . . . . . . . . . . . . . . . . . . 65 sb-concurrency:mailboxp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
sb-posix:getcwd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 sb-thread:main-thread. . . . . . . . . . . . . . . . . . . . . . . . . . . 95
sb-ext:global . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 sb-thread:main-thread-p . . . . . . . . . . . . . . . . . . . . . . . . 95
sb-concurrency:grab-frlock-write-lock . . . . . . . . . . . . . 126 sb-alien:make-alien . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
sb-thread:grab-mutex. . . . . . . . . . . . . . . . . . . . . . . . . . . 102 sb-alien:make-alien-string . . . . . . . . . . . . . . . . . . . . 75
sb-unicode:grapheme-break-class . . . . . . . . . . . . . . . . 57 cl:make-array . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
sb-unicode:graphemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 sb-concurrency:make-frlock . . . . . . . . . . . . . . . . . . . . . . . . . 125
sb-concurrency:make-gate . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
cl:make-hash-table . . . . . . . . . . . . . . . . . . . . . . 60
H sb-bsd-sockets:make-inet-address. . . . . . . . . . . . . . . . . . . 112
sb-unicode:hangul-syllable-type . . . . . . . . . . . . . . . . 56 sb-bsd-sockets:make-inet6-address . . . . . . . . . . . . . . . . . 112
sb-ext:hash-table-synchronized-p . . . . . . . . . . 61 cl:make-instance . . . . . . . . . . . . . . . . . . . . . . . . 49
sb-concurrency:make-mailbox . . . . . . . . . . . . . . . . . . . . . . . . 123
sb-ext:hash-table-weakness . . . . . . . . . . . . . . . . . 61
sb-mop:make-method-lambda . . . . . . . . . . . . . . . . . . 49
help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
sb-pcl:make-method-specializers-form . . . . . . 49
sb-unicode:hex-digit-p. . . . . . . . . . . . . . . . . . . . . . . . . . . 57
sb-thread:make-mutex. . . . . . . . . . . . . . . . . . . . . . . . . . . 102
sb-bsd-sockets:host-ent-address . . . . . . . . . . . . . . . . . . . . 112
sb-concurrency:make-queue. . . . . . . . . . . . . . . . . . . . . . . . . . . 122
cl:make-random-state . . . . . . . . . . . . . . . . . . . . 61
sb-thread:make-semaphore . . . . . . . . . . . . . . . . . . . . . . 102
Appendix B: Function Index 150
S
P sb-sprof:sample-pc . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
sb-ext:package-implemented-by-list . . . . . . . . 94 sb-alien:sap-alien . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
sb-ext:package-implements-list . . . . . . . . . . . . . 94 sb-sys:sap-ref-32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
sb-ext:package-local-nicknames . . . . . . . . . . . . . 43 sb-sys:sap= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
sb-ext:package-locally- cl:satisfies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
nicknamed-by-list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 sb-cover:save-coverage . . . . . . . . . . . . . . . . . . . . . . . 127
sb-ext:package-locked-error-symbol . . . . . . . . 94 sb-cover:save-coverage-in-file . . . . . . . . . . . . . . 127
sb-ext:package-locked-p . . . . . . . . . . . . . . . . . . . . . 94 sb-ext:save-lisp-and-die . . . . . . . . . . . . . . . . . . . . 10
sb-ext:parse-native-namestring . . . . . . . . . . . . . 82 sb-ext:schedule-timer . . . . . . . . . . . . . . . . . . . . . . 107
sb-pcl:parse-specializer-using-class . . . . . . 49 sb-unicode:script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
sb-ext:posix-getenv . . . . . . . . . . . . . . . . . . . . . . . . . 53 sb-ext:search-roots . . . . . . . . . . . . . . . . . . . . . . . . . 46
print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 sb-ext:seed-random-state . . . . . . . . . . . . . . . . . . . . 62
sb-ext:process-alive-p . . . . . . . . . . . . . . . . . . . . . . 55 sb-thread:semaphore-count . . . . . . . . . . . . . . . . . . . . . 103
sb-ext:process-close . . . . . . . . . . . . . . . . . . . . . . . . 55 sb-thread:semaphore-name . . . . . . . . . . . . . . . . . . . . . . 103
sb-ext:process-core-dumped . . . . . . . . . . . . . . . . . 55 sb-thread:semaphore-notification-status . . . . . 103
sb-ext:process-error . . . . . . . . . . . . . . . . . . . . . . . . 55 sb-concurrency:send-message . . . . . . . . . . . . . . . . . . . . . . . . 123
sb-ext:process-exit-code . . . . . . . . . . . . . . . . . . . . 55 sb-unicode:sentence-break-class . . . . . . . . . . . . . . . . 57
sb-ext:process-input . . . . . . . . . . . . . . . . . . . . . . . . 55 sb-unicode:sentences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
sb-ext:process-kill . . . . . . . . . . . . . . . . . . . . . . . . . 55 sb-ext:set-sbcl-source-location . . . . . . . . . . . . 82
sb-ext:process-output . . . . . . . . . . . . . . . . . . . . . . . 55 cl:setf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
sb-ext:process-p . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 setf element function . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
sb-ext:process-status . . . . . . . . . . . . . . . . . . . . . . . 55 cl:setq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Appendix B: Function Index 151
sb-sequence:with-sequence-iterator-functions . . 52 sb-ext:without-package-locks . . . . . . . . . . . . . . . 94
sb-ext:with-timeout . . . . . . . . . . . . . . . . . . . . . . . . . 64 sb-unicode:word-break-class . . . . . . . . . . . . . . . . . . . . . 57
sb-ext:with-unlocked-packages . . . . . . . . . . . . . . 94 sb-unicode:words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
153
+ M
sb-pcl:+slot-unbound+ . . . . . . . . . . . . . . . . . . . . . . . 49 sb-aclrepl:*max-history* . . . . . . . . . . . . . . . . . . . . . . . 120
sb-sprof:*max-samples* . . . . . . . . . . . . . . . . . . . . . . . 118
sb-debug:*max-trace-indentation* . . . . . . . . . . . . . 35
A sb-ext:*module-provider-functions* . . . . . . . . 59
sb-ext:*after-gc-hooks* . . . . . . . . . . . . . . . . . . . . . 44 sb-ext:*muffled-warnings* . . . . . . . . . . . . . . . . . . 59
C O
sb-aclrepl:*command-char* . . . . . . . . . . . . . . . . . . . . . . 120 sb-ext:*on-package-variance* . . . . . . . . . . . . . . . 44
sb-ext:*compiler-print-variable-alist*. . . . 15
sb-ext:*core-pathname* . . . . . . . . . . . . . . . . . . . . . . 11
P
sb-thread:*current-thread* . . . . . . . . . . . . . . . . . . . . . 95
cl:*package* . . . . . . . . . . . . . . . . . . . . . . . . . 42, 91
sb-ext:*posix-argv* . . . . . . . . . . . . . . . . . . . . . . . 9, 53
D sb-aclrepl:*prompt* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
sb-ext:*debug-print-variable-alist* . . . . . . . 27
R
E cl:*random-state* . . . . . . . . . . . . . . . . . . . . . . . 61
cl:*read-default-float-format* . . . . . . . . 42
sb-ext:*ed-functions* . . . . . . . . . . . . . . . . . . . . . . . 59
sb-ext:*evaluator-mode* . . . . . . . . . . . . . . . . . . . . . 25
sb-ext:*exit-hooks* . . . . . . . . . . . . . . . . . . . . . . . . . 14 S
sb-aclrepl:*exit-on-eof* . . . . . . . . . . . . . . . . . . . . . . . 120
sb-sprof:*sample-interval*. . . . . . . . . . . . . . . . . . . 118
sb-ext:*save-hooks* . . . . . . . . . . . . . . . . . . . . . . . . . 11
sb-ext:*stack-allocate-dynamic-extent*. . . . 37
F
sb-ext:*sysinit-pathname-function* . . . . . . . . 11
cl:*features* . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
T
G sb-debug:*trace-encapsulate-default* . . . . . . . . 35
sb-ext:*gc-run-time* . . . . . . . . . . . . . . . . . . . . . . . . 45 sb-debug:*trace-indentation-step* . . . . . . . . . . . . 35
I U
sb-ext:*init-hooks* . . . . . . . . . . . . . . . . . . . . . . . . . 14 sb-aclrepl:*use-short-package-name* . . . . . . . . . . 120
sb-ext:*invoke-debugger-hook* . . . . . . . . . . . . . . 26 sb-ext:*userinit-pathname-function* . . . . . . . 11
154
B J
cl:built-in-class . . . . . . . . . . . . . . . . . . . . . . . 49 sb-thread:join-thread-error . . . . . . . . . . . . . . . . 63, 98
C L
sb-ext:code-deletion-note . . . . . . . . . . . . . . . . . . 16 sb-ext:late-deprecation-warning . . . . . . 141, 144
sb-ext:compiler-note . . . . . . . . . . . . . . . . . . . . . . . . 16 cl:list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
sb-bsd-sockets:local-abstract-socket . . . . . . . . . . . . . . 112
sb-bsd-sockets:local-socket . . . . . . . . . . . . . . . . . . . . . . . . 112
D
sb-sys:deadline-timeout . . . . . . . . . . . . . . . . . . . . . 64
sb-ext:deprecation-condition . . . . . . . . . . . . . . 141
M
sb-ext:deprecation-error . . . . . . . . . . . . . . 141, 142 sb-concurrency: mailbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
sb-thread:mutex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
E
sb-ext:early-deprecation-warning. . . . . 141, 143
N
cl:error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16, 141 sb-ext:name-conflict . . . . . . . . . . . . . . . . . . . . . . . . 59
F P
sb-posix:file-descriptor . . . . . . . . . . . . . . . . . . . . . 133 cl:package-error . . . . . . . . . . . . . . . . . . . . . . . . 91
sb-posix:file-descriptor-designator . . . . . . . . 133 sb-ext:package-lock-violation . . . . . . . . . . 91, 93
sb-posix:filename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 sb-ext:package-locked-error. . . . . . . . . . . . . 91, 93
sb-posix:filename-designator . . . . . . . . . . . . . . . . 134 sb-posix:passwd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
sb-ext:final-deprecation-warning. . . . . 141, 145 sb-sequence:protocol-unimplemented . . . . . . . . . . . . . . 50
cl:float . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42, 62
sb-posix:flock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
sb-concurrency:frlock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Q
sb-mop:funcallable-standard-class . . . . . . . . . 48 sb-concurrency:queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
sb-mop:funcallable-standard-object . . . . . . . . 48
cl:function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
sb-gray:fundamental-binary-input-stream. . . . 85 R
sb-gray:fundamental-binary-output-stream . . 85
cl:rational . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
sb-gray:fundamental-binary-stream . . . . . . . . . . 85
sb-gray:fundamental-
character-input-stream . . . . . . . . . . . . . . . . . . . . . . . . 85 S
sb-gray:fundamental-
character-output-stream . . . . . . . . . . . . . . . . . . . . . . . 85 sb-thread:semaphore . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
sb-gray:fundamental-character-stream . . . . . . . 85 sb-thread:semaphore-notification . . . . . . . . . . . . . 103
sb-gray:fundamental-input-stream . . . . . . . . . . . . 84 cl:sequence . . . . . . . . . . . . . . . . . . . . . . . 49, 50, 52
sb-gray:fundamental-output-stream . . . . . . . . . . 85 sb-bsd-sockets: socket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
sb-gray:fundamental-stream . . . . . . . . . . . . . . . . . . 84 cl:standard-class . . . . . . . . . . . . . . . . . . . . . . . 48
cl:standard-generic-function . . . . . . . . . . 48
cl:standard-object . . . . . . . . . . . . . . . . . . 48, 49
G sb-posix:stat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
cl:structure-class . . . . . . . . . . . . . . . . . . . . . . 49
sb-concurrency:gate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
cl:style-warning . . . . . . . . . . . . . . . . . . . 16, 141
cl:generic-function . . . . . . . . . . . . . . . . . . . . . 48
sb-ext:symbol-package-locked-error. . . . . 91, 93
H T
sb-bsd-sockets:host-ent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 cl:t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
sb-posix:termios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
sb-thread:thread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
I sb-thread:thread-error . . . . . . . . . . . . . . . . . . . . . . . . . 97
sb-bsd-sockets:inet-socket . . . . . . . . . . . . . . . . . . . . . . . . . 111 sb-ext:timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
sb-bsd-sockets:inet6-socket . . . . . . . . . . . . . . . . . . . . . . . . 111 sb-ext:timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
sb-thread:interrupt-thread-error . . . . . . . . . . . . . . 98 sb-posix:timeval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Appendix D: Type Index 155
V W
sb-thread:waitqueue . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
cl:vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 cl:warning . . . . . . . . . . . . . . . . . . . . . . . . . . 16, 141
156
Colophon
This manual is maintained in Texinfo, and automatically translated into other forms (e.g. HTML or pdf). If
you’re reading this manual in one of these non-Texinfo translated forms, that’s fine, but if you want to modify
this manual, you are strongly advised to seek out a Texinfo version and modify that instead of modifying
a translated version. Even better might be to seek out the Texinfo version (maintained at the time of this
writing as part of the SBCL project at http://sbcl.sourceforge.net/) and submit a patch.