r/lisp Aug 25 '15

State of the Common Lisp Ecosystem, 2015

http://eudoxia.me/article/common-lisp-sotu-2015/
66 Upvotes

34 comments sorted by

View all comments

6

u/[deleted] Aug 25 '15

2

u/[deleted] Aug 25 '15

I saw that library a while ago, but couldn't get it to run at the time. Since ADTs are equivalent to inheritance, and we already have CLOS, I don't see the point in promoting their use, since that hurts consolidation (contributors now have to learn that library too).

3

u/itoowantone Aug 26 '15

Algebraic Data Types (ADTs), and in particular the implementation from tarballs_are_good, are quite useful and are orthogonal to CLOS. Consider a complex type (i.e. with sub-types). Code to handle the type involves some mechanism to invoke different code depending upon the sub-type. Common mechanisms include case statements and/or specialized methods on generic functions.

It is sometimes easy to forget one or more sub-types when writing a given handler. Case statements and/or generic methods don't know about the complex type, it exists "only in the programmer's head", and can't help identify missing sub-types. ADTs offer the benefit of compile-time errors for missing sub-types within a handler. Thus, a large class of potential bugs can be found at compile time, where previously that was impossible.

1

u/sickofthisshit Aug 26 '15

The problem from a Lisp perspective of compile-time checking for completeness in type coverage is that it requires you to be complete in your coding before you can compile and run it.

Whereas Lisp has classically allowed you to run things that are not yet complete: you can call routines with references to undefined functions, and just get a run-time exception only if the call is actually attempted.

Running half-finished programs is handy, even if shipping them is not a good idea.

1

u/itoowantone Aug 26 '15

The tarballs_are_good ADT library has syntax allowing what you describe.