3 ms·
Common Lisp includes a type system for static typing. Variables thus can have types in Common Lisp. (defun foo (bar) (declare (type (integer 100 200) bar
by lispm 3y ago
Common Lisp includes a type system for static typing. Variables thus can have types in Common Lisp.
(defun foo (bar)
(declare (type (integer 100 200) bar))
...)
Above declares the variable BAR to have the type of a subtype of integers between 100 and 200.
The language standard does not enforce any static type checking.
What implementations typically might do:
* ignore it: interpreters, Lisp Machines, etc.
* use it for optimizations: most compilers incl. SBCL
* do type inference: many compilers incl. SBCL
* use it at runtime for type assertions: SBCL
* use it at compile time for type checks: SBCL