4 ms·
It seems to me that most successful lisp programs use voluntary expressive names to cope with the lack of type information. (defun turn-cat-into-dog (cat-o
by oconnore 16y ago
It seems to me that most successful lisp programs use voluntary expressive names to cope with the lack of type information.
(defun turn-cat-into-dog (cat-or-nil)
...)
From such a definition, it is clear that this is f:[cat,nil]→dog, but the compiler isn't required to help you if you pass in a 4. This may cause some run time overhead in non-optimized code, but from my experience, is rarely a source of bugs. Has your experience been different?
Perhaps then, the biggest benefit of the type system is that it forces the programmer towards expressive code?
- lispm 16y agoLispers have moved this to object systems sometime in the mid 70s of the last century (starting with Flavors), here CLOS: (defmethod turn-cat-into-dog ((a-cat cat)) ...) (defmethod turn-cat-into-dof ((a-cat null)) ...) or declarations in the mid 80s of the last century: (defun turn-cat-into-dog (thing) (declare (type (or cat null) thing)) ...)