Renderingen-US

Experimental through version 1. Version 0 was alpha. This is the first language release: the interface is relatively stable, not frozen. Nothing is promised stable until version 2.

Types & contracts

Keyword spelling

A type is what a value is. Faber writes the type before the name, so you read the kind of thing first. This page is the syntax of types and the declarations that introduce new ones: interface is a contract of methods, type is another name for an existing type, enum is a closed set of named constants, union is a tagged choice with variants, and schema describes relational columns.

Absence is a union, not a question mark. A missing integer is i32 ∪ none; the missing value is null. There is no i32?. Widths are bare markers — i32, f32 — written in type position.

Everyday types, type first:

main {
    let string name ← "Marcus"
    let i32 age ← 30
    let bool flag ← true
    let list<i32> nums ← [1, 2, 3]
    let i32 ∪ none missing ← null
    print name
    print age
    print flag
    print nums
    print missing
}

A type alias is a transparent name. It does not create a new kind of value:

type Signum = i32
type Nomina = list<string>

main {
    let Signum signum ← 42
    let Nomina sodales ← ["Gaius", "Lucius"]
    print signum
    print sodales
}

Return to the grammar overview.

Terms#

These are the words you write in this part of the language. Each links to its page. The second column names the grammar rule the word belongs to.

TermGrammar rule
interfaceimplendum_decl
fnimplendum_method_decl
typetypus_decl
enumordo_decl
uniondiscretio_decl
schemaschema_decl
columnschema_column
ref, mutunion_hole_type
ref, mutowned_type
recordratio_type

Formal grammar#

The rules for this part of the language are the parser's own definition of it. They are written for models and tools, so this page does not repeat them; the full list is at every production.