CLISP implementation notes

Dr. Bruno Haible

Dr. Sam Steingold

These notes are covered by the GNU GFDL:

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with the Invariant Sections being this section [FIXME], with the Front-Cover Texts being this section [FIXME], and with the Back-Cover Texts being this section [FIXME]. A copy of the license is not yet [FIXME] included in the section entitled "GNU Free Documentation License".


Table of Contents

[CLISP icon]
I Chapters or the [Common Lisp HyperSpec]
1 Introduction [CLHS-1]
Special Symbols [CLHS-1.4.1.3]
Error Terminology [CLHS-1.4.2]
Class Precedence Lists [CLHS-1.4.4.5]
Symbols in the Package “COMMON-LISP” [CLHS-1.9]
2 Syntax [CLHS-2]
Symbols as Tokens [CLHS-2.3.4]
Valid Patterns for Tokens [CLHS-2.3.5]
Double-Quote [CLHS-2.4.5]
Backquote [CLHS-2.4.6]
Sharpsign [CLHS-2.4.8]
3 Evaluation and Compilation [CLHS-3]
Evaluation [CLHS-3.1]
Introduction to Environments [CLHS-3.1.1]
Compilation [CLHS-3.2]
Compiler Terminology [CLHS-3.2.1]
Compiler Macros [CLHS-3.2.2.1]
Definition of Similarity [CLHS-3.2.4.2.2]
Declarations [CLHS-3.3]
Additional declarations
Lambda Lists [CLHS-3.4]
Boa Lambda Lists [CLHS-3.4.6]
The Evaluation and Compilation Dictionary [CLHS-3.8]
Declaration SPECIAL
Macro EVAL-WHEN
4 Types and Classes [CLHS-4]
Types [CLHS-4.2]
Type Specifiers [CLHS-4.2.3]
Classes [CLHS-4.3]
Deviations from [ANSI CL standard]
Standard Metaclasses [CLHS-4.3.1.1]
Defining Classes [CLHS-4.3.2]
Redefining Classes [CLHS-4.3.6]
Integrating Types and Classes [CLHS-4.3.7]
5 Data and Control Flow [CLHS-5]
The Data and Control Flow Dictionary [CLHS-5.3]
Function EQ
Function SYMBOL-FUNCTION
Macro SETF
Special Operator FUNCTION
Macro DEFINE-SYMBOL-MACRO
Macro LAMBDA
Macros DEFUN & DEFMACRO
6 Iteration [CLHS-6]
7 Objects [CLHS-7]
8 Structures [CLHS-8]
9 Conditions [CLHS-9]
Embedded Newlines in Condition Reports [CLHS-9.1.3.1.3]
The Conditions Dictionary [CLHS-9.2.]
10 Symbols [CLHS-10]
11 Packages [CLHS-11]
The COMMON-LISP-USER Package [CLHS-11.1.2.2]
Implementation-Defined Packages [CLHS-11.1.2.4]
The Packages Dictionary [CLHS-11.2.]
Function MAKE-PACKAGE
12 Numbers [CLHS-12]
Numeric Types
Number Concepts [CLHS-12.1]
Byte Operations on Integers [CLHS-12.1.1.3.2]
Rule of Float Substitutability [CLHS-12.1.3.3]
Floating-point Computations [CLHS-12.1.4]
Complex Computations [CLHS-12.1.5]
Rule of Canonical Representation for Complex Rationals [CLHS-12.1.5.3]
The Numbers Dictionary [CLHS-12.2]
Additional Integer Functions
Floating Point
Float Decoding [CLHS]
Boolean Operations [CLHS]
Fixnum Limits [CLHS]
Float Limits [CLHS]
Condition FLOATING-POINT-INVALID-OPERATION
Condition FLOATING-POINT-INEXACT
13 Characters [CLHS-13]
Attributes
Character Scripts [CLHS-13.1.2.1]
Character Attributes [CLHS-13.1.3]
Graphic Characters [CLHS-13.1.4.1]
Alphabetic Characters [CLHS-13.1.4.2]
Case of Implementation-Defined Characters [CLHS-13.1.4.3.4]
Numeric Characters [CLHS-13.1.4.4]
Ordering of Characters [CLHS-13.1.6]
Treatment of Newline during Input and Output [CLHS-13.1.8]
Character Encodings [CLHS-13.1.9]
Documentation of Implementation-Defined Scripts [CLHS-13.1.10]
The Characters Dictionary [CLHS-13.2]
Functions on characters
platform-dependent characters
Obsolete Constants
14 Conses [CLHS-14]
The Conses Dictionary [CLHS-14.2]
Functions MAPCAR, MAPCAN, MAPLIST, MAPCON, ...
15 Arrays [CLHS-15]
Array Elements [CLHS-15.1.1]
The Arrays Dictionary [CLHS-15.2]
16 Strings [CLHS-16]
The Strings Dictionary [CLHS-16.2]
Functions on strings
17 Sequences [CLHS-17]
The Sequences Dictionary [CLHS-17.3.]
Additional Macros
Functions NREVERSE & NRECONC
Functions REMOVE & DELETE
Functions SORT & STABLE-SORT
18 Hash Tables [CLHS-18]
The Hash Tables Dictionary [CLHS-18.2.]
Function MAKE-HASH-TABLE
Additional Macros
19 Filenames [CLHS-19]
Pathname Components [CLHS-19.2.1]
External notation.
Logical Pathnames [CLHS-19.3]
The Filenames Dictionary [CLHS-19.4]
Function PARSE-NAMESTRING
Function MERGE-PATHNAMES
20 Files [CLHS-20]
The Files Dictionary [CLHS-20.2]
Function DIRECTORY
21 Streams [CLHS-21]
Interactive Streams [CLHS-21.1.1.1.3]
terminal interaction.
The Streams Dictionary [CLHS-21.2.]
Function STREAM-ELEMENT-TYPE
Binary input, READ-BYTE, ext:read-integer & ext:read-float
Binary output, WRITE-BYTE, ext:write-integer & ext:write-float
Function READ-SEQUENCE
Function WRITE-SEQUENCE
Function FILE-POSITION
Function OPEN
Function CLOSE
Class BROADCAST-STREAM
22 Printer [CLHS-22]
Multiple Possible Textual Representations [CLHS-22.1.1.1]
Printing Other Vectors [CLHS-22.1.3.7]
Printing Other Arrays [CLHS-22.1.3.8]
The Lisp Pretty Printer [CLHS-22.2]
The Printer Dictionary [CLHS-22.4]
Function FORMAT
pathnames
Miscellaneous Issues
23 Reader [CLHS-23]
characters
Additional read dispatch macros
Function READTABLE-CASE
Functions LISTEN, READ-CHAR-NO-HANG
Function READ-BYTE
24 System Construction [CLHS-24]
24.2: The System Construction Dictionary
Function COMPILE-FILE
Function COMPILE-FILE-PATHNAME
Function REQUIRE
Function LOAD
Variable *FEATURES*
25 Environment [CLHS-25]
Debugging Utilities [CLHS-25.1.2]
The Environment Dictionary [CLHS-25.2]
Function DISASSEMBLE
Function EXT:UNCOMPILE
Function DOCUMENTATION
Macro TRACE
Function INSPECT
EXT:SPACE
Function ROOM
Macro TIME
Function ED
Clock Time
Machine
Functions APROPOS & APROPOS-LIST
Function DRIBBLE
Function LISP-IMPLEMENTATION-VERSION
26 Glossary [CLHS-26]
27 Appendix [CLHS-a]
28 X3J13 Issue Index [CLHS-ic]
II Internals of the CLISP Implementation
1 Overview of CLISP's Garbage Collection
Introduction
CLISP objects
Memory Models
The burden of GC upon the rest of CLISP:
Foreign Pointers
2 The CLISP bytecode specification
Introduction
The virtual machine
The structure of compiled functions
The general structure of the instructions
The instruction set
Instructions for constants
Instructions for lexical variables
Instructions for dynamic variables
Instructions for stack operations
Instructions for control flow, jumps
Instructions for lexical environment, creation of closures
Instructions for function calls
Instructions for optional and keyword parameters
Instructions for multiple values
Instructions for BLOCK and RETURN-FROM
Instructions for TAGBODY and GO
Instructions for CATCH and THROW
Instructions for UNWIND-PROTECT
Instructions for HANDLER-BIND
Instructions for some inlined functions
Combined instructions
Shortcut instructions
III Extensions
1 Extensions-1: Platform independent Extensions
Extensions-1.1. Saving an Image
Extensions-1.2. Quitting Lisp
Extensions-1.3. The Language
Extensions-1.4. Encodings
Introduction
Character Sets
Line Terminators
ext:make-encoding
Converting between strings and byte vectors
Extensions-1.5. Defining new kinds of Streams
Gray streams
Generic streams
Extensions-1.6. Weak Pointers
Extensions-1.7. Finalization
Extensions-1.8. The Prompt
Extensions-1.9. Maximum ANSI CL compliance
Extensions-1.10. Additional Fancy Macros
Extensions-1.11. Customizing CLISP behavior.
2 Extensions-2: Platform specific Extensions
Extensions-2.1. Random Screen Access
Extensions-2.2. External Modules
Example
Modules included in the distribution.
Extensions-2.3. The Foreign Function Call Facility
Overview
(Foreign) C types
Foreign variables
Operations on foreign places
Foreign functions
Argument and result passing conventions
Examples
Extensions-2.4. The Amiga Foreign Function Call Facility
Design issues
Overview
Foreign Libraries
(Foreign) C types
Foreign functions
Memory access
Function Definition Files
Hints
Caveats
Examples
Extensions-2.5. ARexx
Extensions-2.6. Socket Streams
Extensions-2.7. System Calls
Extensions-2.8. Quickstarting delivery with CLISP
Extensions-2.9. Application delivery with CLISP
Extensions-2.10. Shell, Pipes and Printing
Shell
Pipes
Printing
Extensions-2.11. Directory Access
Extensions-2.12. Other
References

[CLISP icon]

These notes discuss the CLISP implementation of Common Lisp by

Dr Bruno Haible
 Louisenstraße 103
 Bad Homburg
 D-61348 Germany
 http://clisp.cons.org/~haible
and
Dr Michael Stoll
 Westerwaldweg 22
 Remagen-Oberwinter
 D-53424 Germany
 http://www.math.uni-duesseldorf.de/home/stoll
The current maintainers are
Dr Bruno Haible
and


This implementation is mostly conforming to the [ANSI CL standard] available on-line as the [Common Lisp HyperSpec] (but the printed ANSI document remains the authoritative source of information). [ANSI CL standard] supersedes the earlier specifications [CLtL1] and [CLtL2].

The first part of these notes is indexed in parallel to the [Common Lisp HyperSpec] and documents the differences between the CLISP implementation of Common Lisp and the [ANSI CL standard].

The second part documents the CLISP garbage-collection (for developers only) and the bytecodes generated by the compiler (i.e., what is printer by DISASSEMBLE).

The third part documents the CLISP extensions.

Chapters or the [Common Lisp HyperSpec]

Table of Contents

1 Introduction [CLHS-1]
Special Symbols [CLHS-1.4.1.3]
Error Terminology [CLHS-1.4.2]
Class Precedence Lists [CLHS-1.4.4.5]
Symbols in the Package “COMMON-LISP” [CLHS-1.9]
2 Syntax [CLHS-2]
Symbols as Tokens [CLHS-2.3.4]
Valid Patterns for Tokens [CLHS-2.3.5]
Double-Quote [CLHS-2.4.5]
Backquote [CLHS-2.4.6]
Sharpsign [CLHS-2.4.8]
3 Evaluation and Compilation [CLHS-3]
Evaluation [CLHS-3.1]
Introduction to Environments [CLHS-3.1.1]
Compilation [CLHS-3.2]
Compiler Terminology [CLHS-3.2.1]
Compiler Macros [CLHS-3.2.2.1]
Definition of Similarity [CLHS-3.2.4.2.2]
Declarations [CLHS-3.3]
Additional declarations
Lambda Lists [CLHS-3.4]
Boa Lambda Lists [CLHS-3.4.6]
The Evaluation and Compilation Dictionary [CLHS-3.8]
Declaration SPECIAL
Macro EVAL-WHEN
4 Types and Classes [CLHS-4]
Types [CLHS-4.2]
Type Specifiers [CLHS-4.2.3]
Classes [CLHS-4.3]
Deviations from [ANSI CL standard]
Standard Metaclasses [CLHS-4.3.1.1]
Defining Classes [CLHS-4.3.2]
Redefining Classes [CLHS-4.3.6]
Integrating Types and Classes [CLHS-4.3.7]
5 Data and Control Flow [CLHS-5]
The Data and Control Flow Dictionary [CLHS-5.3]
Function EQ
Function SYMBOL-FUNCTION
Macro SETF
Special Operator FUNCTION
Macro DEFINE-SYMBOL-MACRO
Macro LAMBDA
Macros DEFUN & DEFMACRO
6 Iteration [CLHS-6]
7 Objects [CLHS-7]
8 Structures [CLHS-8]
9 Conditions [CLHS-9]
Embedded Newlines in Condition Reports [CLHS-9.1.3.1.3]
The Conditions Dictionary [CLHS-9.2.]
10 Symbols [CLHS-10]
11 Packages [CLHS-11]
The COMMON-LISP-USER Package [CLHS-11.1.2.2]
Implementation-Defined Packages [CLHS-11.1.2.4]
The Packages Dictionary [CLHS-11.2.]
Function MAKE-PACKAGE
12 Numbers [CLHS-12]
Numeric Types
Number Concepts [CLHS-12.1]
Byte Operations on Integers [CLHS-12.1.1.3.2]
Rule of Float Substitutability [CLHS-12.1.3.3]
Floating-point Computations [CLHS-12.1.4]
Complex Computations [CLHS-12.1.5]
Rule of Canonical Representation for Complex Rationals [CLHS-12.1.5.3]
The Numbers Dictionary [CLHS-12.2]
Additional Integer Functions
Floating Point
Float Decoding [CLHS]
Boolean Operations [CLHS]
Fixnum Limits [CLHS]
Float Limits [CLHS]
Condition FLOATING-POINT-INVALID-OPERATION
Condition FLOATING-POINT-INEXACT
13 Characters [CLHS-13]
Attributes
Character Scripts [CLHS-13.1.2.1]
Character Attributes [CLHS-13.1.3]
Graphic Characters [CLHS-13.1.4.1]
Alphabetic Characters [CLHS-13.1.4.2]
Case of Implementation-Defined Characters [CLHS-13.1.4.3.4]
Numeric Characters [CLHS-13.1.4.4]
Ordering of Characters [CLHS-13.1.6]
Treatment of Newline during Input and Output [CLHS-13.1.8]
Character Encodings [CLHS-13.1.9]
Documentation of Implementation-Defined Scripts [CLHS-13.1.10]
The Characters Dictionary [CLHS-13.2]
Functions on characters
platform-dependent characters
Obsolete Constants
14 Conses [CLHS-14]
The Conses Dictionary [CLHS-14.2]
Functions MAPCAR, MAPCAN, MAPLIST, MAPCON, ...
15 Arrays [CLHS-15]
Array Elements [CLHS-15.1.1]
The Arrays Dictionary [CLHS-15.2]
16 Strings [CLHS-16]
The Strings Dictionary [CLHS-16.2]
Functions on strings
17 Sequences [CLHS-17]
The Sequences Dictionary [CLHS-17.3.]
Additional Macros
Functions NREVERSE & NRECONC
Functions REMOVE & DELETE
Functions SORT & STABLE-SORT
18 Hash Tables [CLHS-18]
The Hash Tables Dictionary [CLHS-18.2.]
Function MAKE-HASH-TABLE
Additional Macros
19 Filenames [CLHS-19]
Pathname Components [CLHS-19.2.1]
External notation.
Logical Pathnames [CLHS-19.3]
The Filenames Dictionary [CLHS-19.4]
Function PARSE-NAMESTRING
Function MERGE-PATHNAMES
20 Files [CLHS-20]
The Files Dictionary [CLHS-20.2]
Function DIRECTORY
21 Streams [CLHS-21]
Interactive Streams [CLHS-21.1.1.1.3]
terminal interaction.
The Streams Dictionary [CLHS-21.2.]
Function STREAM-ELEMENT-TYPE
Binary input, READ-BYTE, ext:read-integer & ext:read-float
Binary output, WRITE-BYTE, ext:write-integer & ext:write-float
Function READ-SEQUENCE
Function WRITE-SEQUENCE
Function FILE-POSITION
Function OPEN
Function CLOSE
Class BROADCAST-STREAM
22 Printer [CLHS-22]
Multiple Possible Textual Representations [CLHS-22.1.1.1]
Printing Other Vectors [CLHS-22.1.3.7]
Printing Other Arrays [CLHS-22.1.3.8]
The Lisp Pretty Printer [CLHS-22.2]
The Printer Dictionary [CLHS-22.4]
Function FORMAT
pathnames
Miscellaneous Issues
23 Reader [CLHS-23]
characters
Additional read dispatch macros
Function READTABLE-CASE
Functions LISTEN, READ-CHAR-NO-HANG
Function READ-BYTE
24 System Construction [CLHS-24]
24.2: The System Construction Dictionary
Function COMPILE-FILE
Function COMPILE-FILE-PATHNAME
Function REQUIRE
Function LOAD
Variable *FEATURES*
25 Environment [CLHS-25]
Debugging Utilities [CLHS-25.1.2]
The Environment Dictionary [CLHS-25.2]
Function DISASSEMBLE
Function EXT:UNCOMPILE
Function DOCUMENTATION
Macro TRACE
Function INSPECT
EXT:SPACE
Function ROOM
Macro TIME
Function ED
Clock Time
Machine
Functions APROPOS & APROPOS-LIST
Function DRIBBLE
Function LISP-IMPLEMENTATION-VERSION
26 Glossary [CLHS-26]
27 Appendix [CLHS-a]
28 X3J13 Issue Index [CLHS-ic]

Chapter 1. Introduction [CLHS-1]

Special Symbols [CLHS-1.4.1.3]

The final delimiter of an interactive stream: On Unix, the user has to type Ctrl-D at the beginning of a line. On DOS or Win32, the user has to type Ctrl-Z, followed by Return. This final delimiter is never actually seen by programs; no need to test for #\^D or #\^Z - use READ-CHAR-NO-HANG to check for end of stream. Calling CLEAR-INPUT on the stream removes the end-of-stream state, thus making it available for further input.

A newline character can be entered by the user by pressing the Newline key or, on the numeric keypad, the Enter key.

Error Terminology [CLHS-1.4.2]

Safety settings are ignored; therefore where the standard uses the phrase “should signal an error”, an ERROR is signaled.

Class Precedence Lists [CLHS-1.4.4.5]

The class precedence lists of the system classes CLASS BUILT-IN-CLASS, STRUCTURE-CLASS, STANDARD-CLASS, STANDARD-METHOD contain the class STRUCTURE-OBJECT instead of the class STANDARD-OBJECT.

Chapter 2. Syntax [CLHS-2]

Symbols as Tokens [CLHS-2.3.4]

A "reserved token", i.e., a token that has potential number syntax but cannot be interpreted as a number, is interpreted as symbol when being read.

When creating a symbol from a token, no character attributes are removed.

Valid Patterns for Tokens [CLHS-2.3.5]

When a token with package markers is read, then no checking is done whether the package part and the symbol-name part do not have number syntax. (What's the purpose of this check?) So we consider tokens like USER:: or :1 or LISP::4711 or 21:3 as symbols.

Double-Quote [CLHS-2.4.5]

When a string is read, no character attributes are removed.

Backquote [CLHS-2.4.6]

The backquote read macro also works when nested. Example:

   (EVAL ``(,#'(LAMBDA () ',a) ,#'(LAMBDA () ',b)))
 = (EVAL `(list #'(LAMBDA () ',a) #'(LAMBDA () ',b)))
 = (EVAL (list 'list (list 'function (list 'lambda nil (list 'quote a)))
                     (list 'function (list 'lambda nil (list 'quote b)))))


Multiple backquote combinations like ,,@ or ,@,@ are not implemented. Their use would be confusing anyway.

Sharpsign [CLHS-2.4.8]

Reader macros are also defined for the following:

Additional reader macros

Macro Meaning
#, load-time evaluation
#Y function objects and file encodings
#" pathname


Chapter 3. Evaluation and Compilation [CLHS-3]

All the functions built by FUNCTION, COMPILE and the like are atoms. There are built-in functions written in C, compiled functions (both of type COMPILED-FUNCTION) and interpreted functions (of type FUNCTION).

Evaluation [CLHS-3.1]

Introduction to Environments [CLHS-3.1.1]

EXT:THE-ENVIRONMENT As in Scheme, the macro (ext:the-environment) returns the current lexical environment. This works only in interpreted code and is not compilable!

(ext:eval-env form &OPTIONAL env) evaluates a form in a given lexical environment, just as if the form had been a part of the program that the environment came from.

Compilation [CLHS-3.2]

Compiler Terminology [CLHS-3.2.1]

CLISP compiles to platform-independent byte-code.

Compiler Macros [CLHS-3.2.2.1]

Compiler macros are expanded in the compiled code only, and ignored by the interpreter.

Definition of Similarity [CLHS-3.2.4.2.2]

Hash tables are externalizable objects.

Declarations [CLHS-3.3]

The declarations (TYPE type variable ...), (FTYPE type function ...), (OPTIMIZE (quality value) ...) are ignored by the interpreter and the compiler.

The [ANSI CL standard] declaration (OPTIMIZE (debug ...)) is legal.

The [ANSI CL standard] declaration (IGNORABLE variable ...) affects the variable binding for the variable variable. The compiler will not warn about the variable, regardless whether it is used or not.

Additional declarations

The declaration (compile) has the effect that the current form is compiled prior to execution. Examples:

 (LOCALLY (DECLARE (compile)) form)
executes a compiled version of form.

(LET ((x 0))
  (FLET ((inc () (DECLARE (compile)) (INCF x))
         (dec () (DECF x)))
    (VALUES #'inc #'dec)))
returns two functions. The first is compiled and increments x, the second is interpreted (slower) and decrements the same x.

The type assertion (THE value-type form) enforces a type check in interpreted code. No type check is done in compiled code. See also the ext:ethe macro.

Lambda Lists [CLHS-3.4]

Boa Lambda Lists [CLHS-3.4.6]

The initial value of an &AUX variable in a boa lambda list is the value of the corresponding slot's initial form.

The Evaluation and Compilation Dictionary [CLHS-3.8]

Declaration SPECIAL

(PROCLAIM '(SPECIAL variable)) declarations may not be undone. The same holds for DEFVAR, DEFPARAMETER and DEFCONSTANT declarations.

It is an error if a DEFCONSTANT variable is bound at the moment the DEFCONSTANT is executed, but DEFCONSTANT does not check this.

Constants may not be bound dynamically or lexically.

Macro EVAL-WHEN

EVAL-WHEN also accepts the situations (not eval) and (not compile).

Chapter 4. Types and Classes [CLHS-4]

Types [CLHS-4.2]

Type Specifiers [CLHS-4.2.3]

The general form of the COMPLEX type specifier is (COMPLEX type-of-real-part type-of-imaginary-part). The type specifier (COMPLEX type) is equivalent to (COMPLEX type type).

The [ANSI CL standard] type specifier (REAL low high) denotes the real numbers between low and high.

DEFTYPE lambda lists are subject to destructuring (nested lambda lists are allowed, as in DEFMACRO) and may contain a &WHOLE marker, but not an &ENVIRONMENT marker.

(ext:type-expand-1 typespec) If typespec is a user-defined type, ext:type-expand-1 will expand it once and return two values: the expansion and T. If typespec is not a user-defined type, then the two values typespec and NIL are returned.

(ext:type-expand typespec) This is similar to (ext:type-expand-1 typespec), but repeatedly expands typespec until it is no longer a user-defined type. A second value of T or NIL is returned as for ext:type-expand-1, indicating whether the original typespec was a user-definedtype.

The possible results of TYPE-OF are:



Classes [CLHS-4.3]

The CLOS symbols are EXPORTed from the package “CLOS” and thus normally visible in all user packages. If you do not want them (for example, if you want to use the PCL implementation of CLOS instead of the native one), do (UNUSE-PACKAGE "CLOS").

Deviations from [ANSI CL standard]

DEFCLASS It is required that the superclasses of a class be defined before the DEFCLASS form for the class is evaluated.

DEFCLASS supports the option :metaclass STRUCTURE-CLASS. This option is necessary in order to define a subclass of a DEFSTRUCT-defined structure type using DEFCLASS instead of DEFSTRUCT.

When CALL-NEXT-METHOD is called with arguments, the rule that the ordered set of applicable methods must be the same as for the original arguments is enforced by the implementation only in interpreted code.

There is a generic function clos:no-primary-method (similar to NO-APPLICABLE-METHOD) which is called when a generic function of the class STANDARD-GENERIC-FUNCTION is invoked and no primary method on that generic function is applicable.

clos:generic-flet and clos:generic-labels are implemented as macros, not as special operators. They are not imported into the packages “COMMON-LISP-USER” and “COMMON-LISP” because of the [ANSI CL standard] issue GENERIC-FLET-POORLY-DESIGNED:DELETE.

The function ENSURE-GENERIC-FUNCTION is not implemented.

ADD-METHOD can put methods into other generic functions than the one the method came from.

PRINT-OBJECT is only called on objects of type STANDARD-OBJECT and STRUCTURE-OBJECT. It is not called on other objects, like CONSes and NUMBERs, due to the performance concerns.

DOCUMENTATION still has the [CLtL1] implementation.

Defining Classes [CLHS-4.3.2]

DEFCLASS supports the :metaclass option. Possible values are STANDARD-CLASS (the default) and STRUCTURE-CLASS (which creates structure classes, like DEFSTRUCT does).

Redefining Classes [CLHS-4.3.6]

Redefining classes is not supported. The function UPDATE-INSTANCE-FOR-REDEFINED-CLASS is not implemented.

Integrating Types and Classes [CLHS-4.3.7]

The class METHOD-COMBINATION is not implemented.

Chapter 5. Data and Control Flow [CLHS-5]

The Data and Control Flow Dictionary [CLHS-5.3]

PROG1, PROG2, AND, OR, PSETQ, WHEN, UNLESS, COND, CASE, MULTIPLE-VALUE-LIST, MULTIPLE-VALUE-BIND, MULTIPLE-VALUE-SETQ are implemented as special operators and, as such, are rather efficient.

DESTRUCTURING-BIND does not perform full error checking.

Function EQ

EQ compares CHARACTERs and FIXNUMs as EQL does. No unnecessary copies are made of CHARACTERs and NUMBERs. Nevertheless, one should use EQL as it is more portable across Common Lisp implementations.

(let ((x y)) (eq x x)) always returns T, regardless of y.

Function SYMBOL-FUNCTION

(SETF (SYMBOL-FUNCTION symbol) object) requires object to be either a function, a SYMBOL-FUNCTION return value or a lambda expression. The lambda expression is thereby immediately converted to a function.

Macro SETF

Additional places:

FUNCALL

(SETF (FUNCALL #'symbol ...) object) and (SETF (FUNCALL 'symbol ...) object) are equivalent to (SETF (symbol ...) object).

PROGN

(SETF (PROGN form ... place) object)

LOCALLY

(SETF (LOCALLY declaration ... form ... place) object)

IF

(SETF (IF condition place1 place2) object)

GET-DISPATCH-MACRO-CHARACTER

(SETF (GET-DISPATCH-MACRO-CHARACTER ...) ...) calls SET-DISPATCH-MACRO-CHARACTER.

ext:long-float-digits:

(SETF (ext:long-float-digits) digits) sets the default mantissa length of long floats to digits bits.

VALUES-LIST

(SETF (VALUES-LIST list) form) is equivalent to (VALUES-LIST (SETF list (MULTIPLE-VALUE-LIST form)))



&KEY markers in DEFSETF lambda lists are supported, but the corresponding keywords must appear literally in the program text.

(GET-SETF-EXPANSION form &OPTIONAL env), (ext:get-setf-method form &OPTIONAL env), and (ext:get-setf-method-multiple-value form &OPTIONAL env) receive as optional argument the environment necessary for macro expansions. In DEFINE-SETF-EXPANDER and ext:define-setf-method lambda lists, one can specify &ENVIRONMENT and a variable, which will be bound to the environment. This environment should be passed to all calls of GET-SETF-EXPANSION, ext:get-setf-method and ext:get-setf-method-multiple-value. If this is done, even local macros will be interpreted as places correctly.

Attempts to modify read-only data will signal an error. Program text and quoted constants loaded from files are considered read-only data. This check is only performed for strings, not for conses, other kinds of arrays, and user-defined data types.

See also the ext:letf and ext:letf* macros.

Special Operator FUNCTION

(FUNCTION symbol) returns the local function definition established by FLET or LABELS, if it exists, otherwise the global function definition.

(SPECIAL-OPERATOR-P symbol) returns NIL or T. If it returns T, then (SYMBOL-FUNCTION symbol) returns the (useless) special operator handler.

The macro DEFINE-SYMBOL-MACRO establishes SYMBOL-MACROs with global scope (as opposed to SYMBOL-MACROs defined with SYMBOL-MACROLET, which have local scope): (DEFINE-SYMBOL-MACRO symbol expansion).

The function ext:symbol-macro-expand tests for a SYMBOL-MACRO: If symbol is defined as a SYMBOL-MACRO, (ext:symbol-macro-expand symbol) returns two values, T and the expansion, otherwise it returns NIL.

Calling BOUNDP on a symbol defined as a SYMBOL-MACRO returns T.

Calling SYMBOL-VALUE on a symbol defined as a SYMBOL-MACRO returns the value of the expansion. Calling SET on a symbol defined as a SYMBOL-MACRO calls SETF on the expansion.

Calling MAKUNBOUND on a symbol defined as a SYMBOL-MACRO removes the SYMBOL-MACRO definition.

Macro LAMBDA

LAMBDA-LIST-KEYWORDS (&OPTIONAL &REST &KEY &ALLOW-OTHER-KEYS &AUX &BODY &WHOLE &ENVIRONMENT)

Platform dependent

CPU type 16-bit CPU 32-bit CPU 64-bit CPU
CALL-ARGUMENTS-LIMIT 216=65536 232=4294967296
MULTIPLE-VALUES-LIMIT 27=128
LAMBDA-PARAMETERS-LIMIT 216=65536 232=4294967296

Macros DEFUN & DEFMACRO

DEFUN and DEFMACRO are allowed in non-toplevel positions. As an example, consider the old ([CLtL1]) definition of GENSYM:

(let ((gensym-prefix "G")
      (gensym-count 1))
  (defun gensym (&optional (x nil s))
    (when s
      (cond ((stringp x) (setq gensym-prefix x))
            ((integerp x)
             (if (minusp x)
               (error "~S: index ~S is negative" 'gensym x)
               (setq gensym-count x)))
            (t (error "~S: argument ~S of wrong type" 'gensym x))))
    (prog1
      (make-symbol
        (concatenate 'string
          gensym-prefix
          (write-to-string gensym-count :base 10 :radix nil)))
      (incf gensym-count))))

Chapter 6. Iteration