@head @module std @title Class std::Type @index Type

Instances of the Type class represent types (classes or interfaces). They are primarily used for constructing objects (class instances) and for testing the type of objects. The Type constructor cannot be used to build new classes. New types can only be defined using the class and interface constructs. @class Type @desc The Type type. You cannot call this object to create new type objects. @end @see @href{Function types} in Introduction to Alore Type System. @end @see @ref{reflect::TypeOf} allows querying the class of arbitrary objects. @end

Methods

@fun members() as Array @desc Return an array of all defined public member names for the type. The order of the names is arbitrary. The array includes both members defined directly in the type and any inherited members. Not implemented yet @end @fun supertype() as Type @desc Return the direct superclass (if the type is a class) or superinterface (if the type is an interface) of the type, or nil if none exists. @end @fun interfaces() as Array @desc Return an array of type objects that contains all the interfaces that the type implements. It also includes any interfaces that any supertypes implement and any superinterfaces of implemented interfaces. It also includes any interfaces implemented using a bind declaration. Example: @example Int.interfaces() -- Result: [Comparable] @end @end

Operations

Type objects support the following operations: @op type(...) @desc Construct an instance of the type by calling the type object. This operation is only valid for type objects that represent classes. The arguments are passed to the create method of the class. @note Some primitive types do not support directly calling the type object. Instances of these classes must be constructed using other means, such as by using the to operator for creating @ref{Range} objects. @end @end @op x is type @optype{Object is Type} @desc Return a boolean indicating whether x is an instance of type or a subtype of type. If x is nil, return False. @end @op Str(type) @desc Return a string containing the fully qualified name of the type. @end