Ko

A language for programming recursive circuits

Ko
2. Language
2.4. Macros
2.4.5. Macros for type manipulations
2.4.5. Macros for type manipulations

When a circuit operation invokes a gate , the Ko values passed to the gate are “integrated” into the type structure expected by the Go gate implementation.

Integration performs automatic safe type conversions over basic types (among others). For instance a 16-bit signed integer will be converted to a 32-bit signed integer, if necessary, but not to any unsigned one or a narrow type.

For cases where such conversions need to be forced by the programmer, the language provides the macros Int8 , Int16 , Int32 , Int64 , Uint8 , Uint16 , Uint32 , Uint64 , Float32 and Float64 .

All of these macros converts its monadic (unnamed) argument to the required type, using the same conversion semantics as the Go language.