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

Re: standard-type-classes



Moon says:

    I agree.  Actually I'd like to strengthen it: to me, class-of is
like type-of
    and shouldn't be guaranteed portable.  Specifically, when the
standard says
    an object is "of class X", that should -always- mean that class-of
the object
    is allowed to be a subclass of X.

To be more specific, it isn't portable to say.  (eq (class-of
*terminal-io*) 'stream), but it is portable to say (member (class-named
'stream) (class-class-precedence-list (class-of *terminal-io*))).

The distiniction I am drawing is that class-of, unlike type-of is
required to return the most specific class of which its argument is an
instance.  But, when we specify classes, as when we specify types, we
mean that the object in question must be an instance of that class or
some subclass.