On Tue, Oct 24, 2000 at 10:27:31PM +0200, martin@... wrote:
> I'm working on a patch for SBCL (based on one for CMUCL for a 'cons
> The CMUCL-version has a '*null-type*, but I can't find this symbol in
> the SBCL sources.
There was a problem with *NULL-TYPE* not being initialized early
enough. I couldn't find an elegant way to guarantee that it was
initialized early enough, and yet not try to initialize it too early
(before the necessary type machinery was up and running). Therefore, I
punted, deleting the definition of *NULL-TYPE* and replacing all
references to it with calls to (SPECIFIER-TYPE 'NULL).
(From the NEWS file, this occurred in sbcl-0.6.4.)
> Can anyone explain what *empty-type* and *universal-type* really are.
> My guess is, that *universal-type* is the most general type, but this
> may be wrong.
They're the internal representations of (i.e. CTYPE objects
representing) the Common Lisp types NIL and T. They're effectively
synonymous with (SPECIFIER-TYPE NIL) and (SPECIFIER-TYPE T):
* (sb-kernel:specifier-type nil)
* (sb-kernel:specifier-type t)
the most general Common Lisp type? In one sense, yes, type T is the
most general Common Lisp type, but in another sense, type * is more
general. I think roughly
T = I know this could have any value at runtime.
* = I don't know what values this might have at runtime.
(ARRAY T) is a specialized array -- specialized to hold a machine
word which might represent any Lisp object.
(ARRAY *) might be (ARRAY T) or (ARRAY BIT) or (ARRAY CHAR) or ..)
My understanding (from the point of view of a reverse engineer and
maintainer -- I didn't write the code and don't understand some of
it:-) is that *EMPTY-TYPE* and *UNIVERSAL-TYPE* are cached only for
efficiency reasons, simply to reduce the number of calls to
SPECIFIER-TYPE. I could have done the same transformation on them as I
did for *NULL-TYPE*. I didn't do that because I'm a little bit
conservative in general, and specifically because I was afraid it
might bloat the code too much. The *NULL-TYPE* transformation didn't
worry me too much since *NULL-TYPE* wasn't used very many times.
*EMPTY-TYPE* and *UNIVERSAL-TYPE* are more common:
$ find -name '*.lisp' | xargs egrep -i "specifier-type 'null" | wc
7 34 529
$ find -name '*.lisp' | xargs egrep -i "\*empty-type" | wc
70 323 4389
$ find -name '*.lisp' | xargs egrep -i "\*universal-type" | wc
50 187 3147
(in my current sources)
> What could I use substituting *null-type* (in a defoptimizer for #'car)?
(SPECIFIER-TYPE 'NULL) should be fine.
William Harold Newman <william.newman@...>
PGP key fingerprint 85 CE 1C BA 79 8D 51 8C B9 25 FB EE E0 C3 E5 7C