[Next] [Previous] [Up] [Top] [Contents] [Index]

12 The Built-In Functions

Reflective Operations on Types

instance? [Function]


Tests whether an object is an instance of a type.

Signature:
instance? object type Þ boolean

Arguments:
object An instance of <object>.

type
An instance of <type>.

Values:
boolean An instance of <boolean>.

Description:
Returns true if object is a general instance of type.

subtype? [Function]


Tests whether a type is a subtype of another type.

Signature:
subtype? type1 type2 Þ boolean

Arguments:
type1 An instance of <type>.

type2
An instance of <type>.

Values:
boolean An instance of <boolean>.

Description:
Returns true if type1 is a subtype of type2. Subtype rules are given in "The Type Protocol" on page 47

object-class [Function]


Returns the class of an object.

Signature:
object-class object Þ class

Arguments:
object An instance of <object>.

Values:
class An instance of <class>.

Description:
Returns the class of which object is a direct instance.

all-superclasses [Function]


Returns all the superclasses of a class.

Signature:
all-superclasses class Þ sequence

Arguments:
class An instance of <class>.

Values:
sequence An instance of <sequence>. Each element in the sequence is an instance of <class>.

Description:
Returns all the superclasses of class in a sequence. The order of the classes in the sequence will correspond to the class precedence list of class.

The result sequence 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 [Function]


Returns the direct superclasses of a class.

Signature:
direct-superclasses class Þ sequence

Arguments:
class An instance of <class>.

Values:
sequence An instance of <sequence>. Each element in the sequence is an instance of <class>.

Description:
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 result sequence 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 [Function]


Returns the direct subclasses of a class.

Signature:
direct-subclasses class Þ sequence

Arguments:
class An instance of <class>.

Values:
sequence An instance of <sequence>. Each element in the sequence is an instance of <class>.

Description:
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 not significant.

The result sequence 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 subclasses.


Dylan Reference Manual - 17 OCT 1995
[Next] [Previous] [Up] [Top] [Contents] [Index]

Generated with Harlequin WebMaker