viewtypedef initializable (vt:viewt@ype) = [initialized: bool] @{ initialized = bool initialized, obj = opt (vt, initialized) } fun {vt:viewt@ype} uninitialized (v : opt(vt,false)): initializable vt fun {vt:viewt@ype} exec_void (r: ref(initializable vt)): void fun {vt:viewt@ype} exec_void$fwork (v : &vt): void // function will also inialize if not yet initalized fun {vt:viewt@ype} exec_init (r: ref(initializable vt)): void fun {vt:viewt@ype} {a: t@ype} exec (r: ref(initializable vt)): a fun {vt:viewt@ype} {a: t@ype} exec$fwork (v : &vt): a fun {vt:viewt@ype} initialize (r: ref(initializable vt)): void fun {vt:viewt@ype} initialize$fwork (v: &vt? >> opt(vt,success)): #[success : bool] bool success