AbstractTermificator
Skeletal implementation of Termificator, providing the type-dispatch machinery (termify) and a library of protected handleXxxAsYyy conversion functions that subclasses register (via handleType) to implement Termificator.default/Termificator.legacy and any other custom conversion policy.
Conversions are looked up in converters, a registration-ordered map from KClass to converter function: an exact match on value::class is tried first, then the map is scanned in registration order for the first registered type the converted value is an instance of — so more specific types should be handleType-registered before more general ones (see legacyConfiguration/novelConfiguration for the order this module itself relies on).
A subclass only needs to implement handleNumberAsNumeric (the concrete Number-to-Term policy differs between platforms, e.g. to leverage native BigInteger/BigDecimal types) and call defaultConfiguration — or handleType directly — from its constructor to populate converters.
Properties
Functions
Creates a copy of this Termificator, backed by scope (defaulting to this one's own scope).
Converts value to a Term: returns it unchanged if it already is one, delegates to TermConvertible.toTerm if it is a TermConvertible, otherwise dispatches to the converters registered via handleType (exact runtime type first, then the first registered supertype value is an instance of).