[Next] [Previous] [Up] [Top] [Contents] [Index]
3.4 Special Types and Type Constructors
Types with names can be directly named:
named_type ::= name
As described in section 3.3.1, type names are resolved in a name space distinct from the names of variables and objects and of methods.
In addition to user-defined types introduced through type
and object
declarations, the Cecil type system includes four special predefined types:
void
is used as the result type of methods and closures that do not return a result. All types are subtypes of void
, enabling a method that returns a result to be used in a context where none is required. The type void
may only be used when declaring the result type of a method or closure. The predefined object void
has type void
.
any
is implicitly a supertype of all types other than void
; any
may be used whenever a method does not require any special operations of an object.
none
is implicitly a subtype of all other types, thus defining the bottom of the type lattice. It is the result type of a closure that terminates with a non-local return, since such a closure never returns to its caller. It also is the result type of the primitive loop
method, which also never returns normally. Finally, none
is an appropriate argument type for closures that will never be called.
dynamic
is used to indicate run-time type checking. Wherever type declarations are omitted, dynamic
is implied (with the exception of closure results and constant local variable declarations, as described in section 3.3.7). The dynamic
type selectively disables static type checking, in support of exploratory programming, as described in section 3.10.
[Next] [Previous] [Up] [Top] [Contents] [Index]
Generated with Harlequin WebMaker