Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

NIL=() Considered Harmful

Name: Anonymous 2013-04-06 15:29

Consider function READ, which parses a list of elements or returns NIL on syntax error. Such READ function would provide no way to read an empty list, because return would be indiscernible from error. But Lisp indulges creation of such read functions, because checking for NIL is much easier than checking for exception.

Moreover, it breaks strong-typing, making harder to guess author's intention.

Name: Anonymous 2013-04-07 2:49

>>8
Common Lisp also has a confusing lot of NIL/CONS related predicates, like there is CONSP, LISTP, ATOM and NULL, while TYPECASE discerns between LIST, CONS, BOOLEAN and NULL. Then ATOM considers NIL an atom, so if you have some code that should be invoked on every list, you can miss some empty lists.

NIL=() ("nil punning", as Rich Hickey calls it) is the single worst Lisp wart. Just use Scheme/Racket, even if currently Scheme compilers are slower, absence of nil-punning should make compilation easier.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List