IN: bare
-ERROR: invalid-enum value ;
-
SINGLETONS: uint ;
SINGLETONS: int ;
SINGLETONS: u8 u16 u32 u64 ;
TUPLE: user name type ;
TUPLE: schema types ;
+ERROR: invalid-enum value ;
+ERROR: invalid-union value ;
+
GENERIC: write-bare ( obj schema -- )
M: uint write-bare
'[ _ _ [ read-bare ] bi@ 2array ] replicate ;
M: union read-bare
- [ uint read-bare ] dip members>> value-at read-bare ;
+ [ uint read-bare ] dip members>> ?value-at
+ [ read-bare ] [ invalid-union ] if ;
M: user read-bare type>> read-bare ;