[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Esoteric DEFTYPE :type property
Here's a very esoteric property -- I hesiate to call it a bug -- of
TYPEP.
>(defstruct (quux (:type list) :named) x y)
QUUX
>(deftype quux () '(satisfies quux-p))
QUUX
>(typep (make-quux) 'quux)
NIL
Steele isn't clear on what should happen, but Lucid 2.2 returns T, which
seems to be a more useful value.
The reason for this behavior is that TYPEP tests first to see if (make-quux)
is a structure, and tests for a deftype-definition only if it's not. One
fix is to reverse the two cond clauses at the end of the definition
of type in predlib.lsp, if anybody really cares.