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

Re: Moon's Comments

>    and one for
>    specifying that a variable name can be bound to an
>    object of a particular class *or a subclass*, since
>    the restriction to a single class is covered by TYPE.
>I think you're mistaken here.  (THE INTEGER x) does not
>imply that x is not a FIXNUM, and similarly (THE C x) does
>not imply that (CLASS-OF x) is not a subclass of C.  I don't
>think Common Lisp has any way to declare that an object is of
>a given type, and no more-specific type.

I was going on the basis of the statement on the bottom of
pg. 161, top of pg. 162 of CLtL:

"In effect, this declares that the user undertakes to guarantee
that the values of the form will always be of the specified type."

in the description of THE semantics. A previous disclaimer, however,
states that it is up to the implementation whether this is checked
or not. In addition, on pg. 158, the description of the TYPE DECLARE

"In particular, values assigned to variables by SETQ, as well as
the initial values of the variables, must be of the specified type."

implies that subtyping is not allowed. My recollection of the typing
chapter is that subtyping is allowed, however, so the situation is