The special type Nothing represents:
- the intersection of all types, or, equivalently
- the empty set
Nothing is assignable to all other types, but has no instances.
A reference to a member of an expression of type Nothing is always an error, since there can never be a receiving instance.
Nothing is considered to belong to the module ceylon.language. However, it cannot be defined within the language.
Because of the restrictions imposed by Ceylon's mixin inheritance model:
- If X and Y are classes, and X is not a subclass of Y, and Y is not a subclass of X, then the intersection type X&Y is equivalent to Nothing.
- If X is an interface, the intersection type X&Nothing is equivalent to Nothing.
- If X<T> is invariant in its type parameter T, and the distinct types A and B do not involve type parameters, then X<A>&X<B> is equivalent to Nothing.