3 ms·
Common Lisp is a modern Lisp with static typing, too. For example, here's compile-time type checking performed by the SBCL compiler: * (defun test (x)
by xenophonf 13y ago
Common Lisp is a modern Lisp with static typing, too. For example, here's compile-time type checking performed by the SBCL compiler:
* (defun test (x)
(declare (fixnum x))
(the string x))
; in: DEFUN TEST
; (THE STRING X)
;
; caught WARNING:
; Derived type of X is
; (VALUES FIXNUM &OPTIONAL),
; conflicting with its asserted type
; STRING.
; See also:
; The SBCL Manual, Node "Handling of Types"
;
; compilation unit finished
; caught 1 WARNING condition
STYLE-WARNING: redefining COMMON-LISP-USER::TEST in DEFUN
TEST
* (test 1)
debugger invoked on a SIMPLE-TYPE-ERROR:
Value of X in (THE STRING X) is 1, not a STRING.
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
(SB-C::%COMPILE-TIME-TYPE-ERROR (1) STRING #<unavailable argument> ((THE STRING X) X))
0] 0