Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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?



Lispers 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))
      ...)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: