License: Public Domain , Load it with Quicklisp: (ql:quickload "fakenil")
Library type: Convenience feature , Project complexity: Embarrassingly trivial

fakenil provides a canonical stand-in for nil for contexts where nil means "no value".


In many contexts, nil is a special value meaning "no value" or similar. In many of those contexts, nil would not be a meaningful normal value anyway (or both meanings coincide), so there are no difficulties.

The question arises of how best to represent a normal value of nil in those contexts where nil is already a special value, since we then need to distinguish between these two incompatible meanings of nil.

There is of course the traditional strategy of using a second value indicating whether the first value is meaningful, as gethash does, but this is almost always overkill. Reserving nil as the special value is the right call in most contexts, even when nil might theoretically or occasionally make sense as a normal value.

Yet it might still happen that someone needs to represent a normal value of nil in such contexts. Traditionally, users would choose an arbitrary stand-in value on an ad-hoc basis, and this might need to be documented, or might be left undocumented, leaving other users to choose their own arbitrary stand-in values anew. fakenil provides nil*, a canonical value to use in such scenarios. Besides slight increases in code quality, convenience and ergonomics, using this specific stand-in value instead of arbitrary other stand-in values helps tracking the usage of this idiom, and other libraries can reference fakenil (which is fully and solely dedicated to this concept) instead of inventing and documenting their own similar concept or leaving the issue open.


Dictionary » nil*

Package nil*


This package is also nicknamed fakenil. (The shorter name is used as the package name to make output more pleasant. Moreover, the primary reason the project is called "fakenil" rather than "nil*" is because "*" in a project name is judged likely to cause interoperability problems.)

This package exports a single symbol, nil*. Either (:import-from #:nil* #:nil*) from your defpackage or explicitly refer to it as nil*:nil*, both approaches are valid. Don't (:use)!

Note that while this symbol is not often used in source code, therefore making explicit package-qualification viable, importing it can help make for a cleaner debugging experience (if you'd rather not see nil*:nil* being passed around).

Constant nil*


The value of this constant is its name, the symbol nil*.