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.
See also: Function types in Introduction to Alore Type System.
See also: reflect::TypeOf allows querying the class of arbitrary objects.
- members() as Array<Str>
- 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
- supertype() as Type
- 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.
- interfaces() as Array<Type>
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.
Int.interfaces() -- Result: [Comparable]
Type objects support the following operations:
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 Range objects.
- x is type (Object is Type)
- Return a boolean indicating whether x is an instance of type or a subtype of type. If x is nil, return False.
- Return a string containing the fully qualified name of the type.