On Tue, Aug 20, 2002 at 02:52:04PM +0100, Christophe Rhodes wrote:
> Hi, all.
> If we're willing to live with
> (SUBTYPEP '(VECTOR UNDEFTYPE) 'VECTOR)
> NIL, NIL
Bill suggested that this wasn't ideal, and wondered about making the
CTYPE object for (VECTOR UNDEFTYPE) be, loosely,
(AND VECTOR #<UNKNOWN-TYPE (VECTOR UNDEFTYPE)>)
However, this causes a different problem; when you try to compile
something like (typep x '(vector undeftype)), it compiles first a call
to (typep x 'vector), then a call to (typep x '(vector undeftype)) ...
and we have recursio ad absurdum :-(
If we want to keep (SUBTYPEP '(VECTOR UNDEFTYPE) 'VECTOR) as T, T, we
can do something else; however, there will be, I believe, some subtle
bugs. For instance, we could make the
array-type-specialized-element-type for (VECTOR UNDEFTYPE) be UNDEFTYPE;
however, this might lead to wrong behaviour when we later define
UNDEFTYPE to be '(SINGLE-FLOAT 0.0), as we will then have spurious
assertions in our compiled code that all floats are greater than zero...
Making the array-type-specialized-element-type be *WILD-TYPE* avoids
this problem, instead letting through some incorrect code a la
(defun foo (x)
(declare (type (vector bar) x))
(aref x 1))
(deftype bar () 'single-float)
(foo (make-array 3 :element-type 'double-float)) -> 0.0d0
but maybe this is what's preferred?
Jesus College, Cambridge, CB5 8BL +44 1223 510 299
http://www-jcsu.jesus.cam.ac.uk/~csr21/ (defun pling-dollar
(str schar arg) (first (last +))) (make-dispatch-macro-character #\! t)
(set-dispatch-macro-character #\! #\$ #'pling-dollar)