Distinguished Object Entry: NIL

← Prev | ↑ Chapter | Next → | Index | Symbols

Distinguished Object Entry: NIL

Name

nil

Class

Distinguished object

Related Types

  • generalized boolean false
  • listp returns T for nil, but (type nil) returns nil — nil is not of type LIST (which is cons cells only; see "Type Entry: LIST" and the listp-vs-LIST note there).

Description

nil is a distinguished object in AutoLISP.

In documented AutoLISP behavior:

  • nil denotes falsity in conditional and predicate contexts,
  • nil is also the empty list,
  • (type nil) returns nil, not a distinct runtime type designator such as NIL,
  • listp returns T for nil (but nil is not of type LIST; the LIST designator covers cons cells only — (type '()) is nil),
  • null and not return T for expressions that evaluate to nil.

Accordingly, this specification does not treat nil as a separate runtime type in the same sense as INT, REAL, STR, LIST, or SYM.

Discussion: nil as bottom (⊥)

The otherwise-odd facts above cohere under a single reading: in AutoLISP nil serves as bottom (⊥). Every operation on bottom yields bottom, which explains, without special cases:

(type nil)                  => nil    ; not SYM, not a distinct NIL designator
(boundp 'nil)               => nil
(not (eq 'sym (type 'nil)))          ; the type of nil is NOT the symbol SYM

If nil were an ordinary symbol that evaluates to nil, then (boundp 'nil) returning nil would be inconsistent — a self-evaluating symbol that is nonetheless reported unbound. The ⊥ reading makes the whole family coherent: (quote ⊥) => ⊥, (boundp ⊥) => ⊥, (type ⊥) => ⊥. The dual view — "there is a singleton type NIL whose sole inhabitant prints as nil" — is equivalent; either way nil must not be collapsed to the Common Lisp symbol/type model.

The comparison predicates = /= < <= > >= are another manifestation of ⊥ propagation: they signal a type error on genuinely incompatible non-nil argument types, but return nil (not an error) when any argument is nil — e.g. `(< 1 nil) > nil, (< "abc" nil) => nil, ( nil nil) > nil`. See "The Comparison Operators =, /, <, <=, >, >=" (chapter 5).

Representation

It is printed as nil in value position and corresponds semantically to the empty list ().

Valid Operations

  • listp returns T
  • vl-symbolp returns nil
  • type returns nil
  • conditional contexts treat it as false

Compatibility

This is a core language distinction and must not be collapsed to generic Common Lisp symbol or type behavior.

In particular, the Common Lisp type named nil is not an appropriate model for AutoLISP's documented type behavior.