Next: Tuples
Up: Basic data types and
Previous: Characters
Index
In absent.diesel:
The mb[T] parameterized type represents either a value of type
T or the value absent, akin to ML's option datatype.
mb[T] differs from maybe[T] in that mb[T] doesn't
introduce a level of indirection, but cannot store absent as a
non-absent value. (The current Diesel typechecker also has some
limitations in its handling of or-types like mb[T], such as
that such a type cannot be directly declared to be subtypes of
comparable[mb[T]].)
The distinguished absent value:
mb[T] is either absent or a T:
synonym mb[T] = T | absent;
Testers:
fun is_present(:mb[`T]):bool;
fun is_absent(:mb[`T]):bool;
``Typecase'' operations:
fun if_present(:mb[`T], if_present:&(T):`R, if_absent:&():`R):R;
fun if_present(:mb[`T], if_present:&(T):void):void;
fun if_absent (:mb[`T], if_absent:&():`R, if_present:&(T):`R):R;
fun if_absent (:mb[`T], if_absent:&():void):void;
Checked ``downcast'' operations:
fun as_present(:mb[`T]):T;
fun as_present(:mb[`T], :&():T):T;
Next: Tuples
Up: Basic data types and
Previous: Characters
Index
Cecil/Vortex Project