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

Types in CL

    Date: Sun, 27 Dec 87 13:15:46 PST
    From: Jon L White <edsel!jonl@labrea.stanford.edu>

	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
		     (= (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
    should be 

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

This contradicts an explicit statement to the contrary in CLtL.  On page
46, it says:

     (ARRAY CHARACTER) is not the set of all arrays that can hold
     characters, but rather the set of arrays that are specialized to
     hold characters and no other objects.  To test whether an array FOO
     can hold a character, one should not use


     but rather


I therefore stand by my translation.