POLYTONE — the AI-native programming language

Guide

Records

Nominal product types with named-field construction in declaration order — one canonical way to build a value.

records.pt
record User:
    name: Text
    age: Int

/// Renders a short profile line.
pub fn profile(u: User) -> Text:
    return "{u.name} ({u.age})"

fn main() -> Void:
    mut u = User(name: "Ada", age: 36)
    u.age = u.age + 1
    print(profile(u))
    print("{u}")

Fields are written in declaration order, always all of them, always named — wrong order is a teaching error that prints the canonical form. Records print as constructor syntax, so debug output is valid source.