[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Types in CL



re: 
    Actually, there is a bug in your original message, in the TYPEP call.
    The predicate
	    (TYPEP A 'T1)
    expands to
	    (TYPEP A '(ARRAY T2 1))
    which is equivalent to
	    (AND (ARRAYP A)
		 (EQ (ARRAY-ELEMENT-TYPE A) 'T2)
		 (= (ARRAY-RANK A) 1)
		 (= (ARRAY-DIMENSION A 0) 1))

This isn't right, and is probably a good example of the single most common 
error when trying to figure out what the array types mean.  Since a CL
implementation of arrays is permitted to "upgrade" the :element-type
argument into something actually supported, and since there is no 
requirement to preserve the original :element-type argument, then the
line above
		 (EQ (ARRAY-ELEMENT-TYPE A) 'T2)
should be 
		 (SUBTYPEP 'T2  (ARRAY-ELEMENT-TYPE A))

Of course, optimizations are possible for specific T2's; but in general
the element-type might have been upgraded to, for example, T.


-- JonL --