•
|
A module can be passed as the type specification to a call to type or in a :: expression. By default a module is considered the type of another module if and only if they both share the same module definition. This is true of all objects of the same class. The ModuleType method allows a module to refine the type check when a module is given as a type.
|
•
|
If a module that defines a ModuleType procedure is given as the type, and the given expression is a module matching that type, the ModuleType procedure will be called to further refine the type checking.
|
•
|
The calling sequence of a ModuleType procedure is:
|
>
|
export ModuleType::static := proc( M, typ, arg1, ... )
|
M : is the module that is being tested to see if it matches type typ
typ : is the type whose ModuleType procedure was called
arg1, ... : additional argument specified with the type, typ(arg1, ... )
•
|
The ModuleType routine should not make type checks using its containing module as a type. This can lead to infinite recursion.
|
•
|
An object can implement a type override to allow the object to determine if it matches various types. For more information, see the object/builtins page.
|