Previous section: Instance creation

Dylan reference manual -- Reflective Operations on Types

Reflective Operations on Types

The following operations return information about types and objects.
instance?   object type   =>  boolean	[Function]
instance? returns true if object is a general instance of type.
subtype?   type1 type2   =>  boolean	[Function]
subtype? returns true if type1 is a subtype--either direct or indirect--of type2, or if type1 and type2 are the same type.
object-class   object   =>  class	[Function]
object-class returns the class of which object is a direct instance.
all-superclasses   class   =>  sequence	[Function]
all-superclasses returns all the superclasses of class in a sequence. The order of the classes in the sequence is significant. The first element in the sequence will always be class, and <object> will always be the last.

The sequence returned should never be destructively modified. Doing so may cause unpredictable behavior. If class is sealed, an implementation may choose to signal an error of type <sealed-object-error> rather than returning the sequence of all superclasses.

direct-superclasses   class   =>  sequence	[Function]
direct-superclasses returns the direct superclasses of class in a sequence. These are the classes that were passed as arguments to make or define class when the class was created. The order of the classes in the sequence is the same as the order in which they were passed to define class, or make when class was created.

The sequence returned should never be destructively modified. Doing so may cause unpredictable behavior. If class is sealed, an implementation may choose to signal an error of type <sealed-object-error> rather than returning the direct superclasses.

direct-subclasses   class   =>  sequence	[Function]
direct-subclasses returns the direct subclasses of class in a sequence. These are the classes that have class as a direct superclass. The order of the classes in the sequence is insignificant.

The sequence returned should never be destructively modified. Doing so may cause unpredictable behavior.[23] If class is sealed, an implementation may choose to signal an error of type <sealed-object-error> rather than returning the direct subclasses.

Next section: Coercing and Copying Objects