Field iteration support types

pub enum FieldValue {
  FvBool { v: boolean },
  FvInt { v: integer },
  FvLong { v: integer },
  FvFloat { v: float },
  FvSingle { v: single },
  FvChar { v: character },
  FvText { v: text },
}

Wraps a field value in a type-discriminated enum for compile-time field iteration.

pub struct StructField {
  name: text,
  value: FieldValue,
  // Was the field DECLARED nullable (`text?` rather than `text`)?
  //
  // The payload variants above are typed non-null, and `τ?` shares `τ`'s
  // runtime layout (@PLN25) — a nullable field spells absence with a SENTINEL
  // rather than a wrapper. So a null field's value arrives inside `FvText` /
  // `FvInt` / … as that sentinel, and this flag is what says so; without it a
  // reader would have to discover the possibility by being surprised.
  //
  // Mirrors `FieldInfo.nullable` from `type_of` (07_reflect.loft) on purpose:
  // the two field lists describe the same declaration and must agree.
  nullable: boolean,
}

Represents a single struct field during compile-time iteration.

pub fn to_text(self: integer) -> text

Built-in `to_text` impls so primitives satisfy `Printable` automatically. Placed after every OpFormat* / OpAppend* declaration above so format-string interpolation in the bodies can resolve to the relevant built-in. Without these impls, Converts an integer to its decimal text. Built-in types define `to_text` so they satisfy the `Printable` interface (used by `print`, format strings, …).

pub fn to_text(self: float) -> text

Converts a float to its text representation.

pub fn to_text(self: single) -> text

Converts a single-precision float to its text representation.

pub fn to_text(self: boolean) -> text

Converts a boolean to "true" or "false".

pub fn to_text(self: character) -> text

Converts a character to a one-character text.

pub fn to_text(self: text) -> text

Returns the text unchanged — the identity case, so `text` satisfies `Printable` too.