3 ms·
Try Common Lisp. Unless you tell it otherwise, Steel Bank Common Lisp treats all type declarations as assertions. They are checked at runtime. The compiler also
by massysett 3y ago
Try Common Lisp. Unless you tell it otherwise, Steel Bank Common Lisp treats all type declarations as assertions. They are checked at runtime. The compiler also does a great deal of compile-time checking too.
But if you don’t like to use any of it you don’t have to. So you can annotate just some code, either because you want the types checked or for performance reasons.
One caveat though: SBCL’s treatment of type declarations in this manner is implementation specific (well, SBCL’s predecessor, CMUCL, also did this.) The Common Lisp standard simply says the result is undefined if a value’s type does not match the declaration. So a more portable way to do this is to use the CHECK-TYPE macro and use declarations only for performance reasons.