System.ConverterOf - Manhunter07/MFL GitHub Wiki

Declaration

function ConverterOf(T: type): function = \built-in\

Description

The ConverterOf function in the System package returns the converter of a given type passed by reference. The argument for the Obj parameter must be a type reference. If the type has a declared or implicit constructor, it is returned as reference. If not, the function returns Nil.

Example

See also: System.Split

A type without a converter strictly returns Nil when passed:

type PersonName = record(First, Last, Title)
Converter(@PersonName) \returns Nil\

If we then however declare a converter, it will be returned as a function-reference:

converter PersonName(FullName: String) = Split(' ', FullName)
ConverterOf(@PersonName) \returns a reference to the converter above\

See also