Generic type conversion: the Convert class over the type system’s from/to alists.
Hot consumers fetch the dispatcher from the catalog: (prim-ref ‘convert ‘to). The no-match policy is the (Convert missing) member.
ConvertmissingNo-match policy handler (fn (_ val target)). The dialect sets it – raise, coerce, log, … Default returns nil.
Member: data carried by a Convert instance.
(Convert to val target . extra)Convert VAL to the TARGET type via the type system’s registered conversions.
Parameters:
ANY — Value to convertANY — Target type handle (e.g. (Type of 0))ANY — Converter-specific arguments (e.g. a radix)Returns: ANY — The converted value; on no registered conversion, (Convert missing)’s result (default nil)
(Convert to-int v what)V as an INT: V itself when it is one, else its registered conversion to INT; raises WHAT when there is none.
Parameters:
ANY — Value to use as an INTSTRING — The error’s message when v does not convertReturns: INT — The integer