Re:The Land of Lisp
by lispm on Friday October 06, 2017 @05:02PM
(#15420470)
You actually said:
> Without type annotations and checked structured data for everything, it can also be hard to remember what a function does, or what its variables represent, when you read the code later.
I showed you how to annotate types in Common Lisp.
You also said:
> The other feature that occurs more often is in-line documentation.
Which exists in Lisp since 80s or earlier.
> but I'm really talking about compile time checks.
(declaim (ftype (function (integer string) cons)
foo))
(defun foo (a b)
(list a b))
(defun bar (a) (foo "baz" a))
Running the SBCL compiler:
; file: /private/tmp/test.lisp
; in: DEFUN BAR
; (FOO "baz" A)
;
; note: deleting unreachable code
;
; caught WARNING:
; Constant "baz" conflicts with its asserted type INTEGER.
; See also:
; The SBCL Manual, Node "Handling of Types"
At least some type checks are done at compile time...
> Without type annotations and checked structured data for everything, it can also be hard to remember what a function does, or what its variables represent, when you read the code later.
I showed you how to annotate types in Common Lisp.
You also said:
> The other feature that occurs more often is in-line documentation.
Which exists in Lisp since 80s or earlier.
> but I'm really talking about compile time checks.
Running the SBCL compiler: At least some type checks are done at compile time...