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 {
  pub name: text,
  pub value: FieldValue,
  // Was the field DECLARED nullable (`text?` rather than `text`)?
  //
  // The payload variants above are typed non-null, and `τ?` shares `τ`'s
  // runtime layout — 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.
  pub nullable: boolean,
}

Represents a single struct field during compile-time iteration.

pub operator to_text(self: integer) -> text

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 operator to_text(self: float) -> text

Converts a float to its text representation.

pub operator to_text(self: single) -> text

Converts a single-precision float to its text representation.

pub operator to_text(self: boolean) -> text

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

pub operator to_text(self: character) -> text

Converts a character to a one-character text.

pub operator to_text(self: text) -> text

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