Repository navigation
Expressions and operators
Expressions appear in defaults, fixtures, contract conditions, helper bodies and examples. They describe values, calls and conditions; the compiler checks their meaning without executing the application.
From strongest to weakest:
| Operators | Meaning |
|---|---|
(...), member ., call (...)
|
Grouping, field/member selection, invocation |
Unary +, -, not
|
Numeric sign or Boolean negation |
*, /, %
|
Numeric multiplication, division, remainder |
+, -
|
Numeric addition/subtraction |
==, !=, <, <=, >, >=
|
Comparison |
and |
Boolean conjunction |
or |
Boolean disjunction |
Arithmetic is numeric; + does not concatenate Text. and, or and not need Boolean values. Comparisons cannot be chained: write a < b and b < c, not a < b < c.
main.expec
examples {
example "precedence": 2 + 3 * 4 => 14
example "grouping": (2 + 3) * 4 => 20
example "remainder": 9 % 4 => 1
example "Boolean condition": not false and 2 < 3 or false => true
}These are authored expected outcomes, not compiler evaluation results.
main.expec
type Book {
title: Text
}
function titleOf(book: Book) returns Text
examples {
fixture dune: Book = Book { title: "Dune" }
example "read the field": dune.title => "Dune"
example "call a function": titleOf(dune) => "Dune"
}A selected field must exist on the receiver's known type. A capability called through a receiver must be public. An opaque or optional receiver cannot silently provide a nonoptional field or operation. A named operation is not a call until you supply parentheses.
main.expec
type Book {
title: Text
}
type Shelf {
books: List<Book>
corner: [Number, Number]
}
examples {
fixture empty: Shelf = Shelf {
books: [],
corner: [0, 0],
}
}An empty list needs a known expected element type, as books supplies here. An anonymous record needs a suitable unambiguous expected record type. Named record literals distinguish nominal types with otherwise identical fields.
| Symbol | Use |
|---|---|
: |
Annotate a parameter, field or fixture; separate a record entry; separate a short example's title |
= |
Alias definition, default, fixture/local value, or scenario capture |
=> |
Separate a short example's actual expression from its expectation |
-> |
Send an authored interaction message, not a general expression |
? |
Optional type suffix |
| |
Type union; Boolean alternatives use or
|
<T> |
Generic parameters or arguments in type contexts |
There is no general assignment, indexing operator, lambda, conditional statement or loop syntax in this language version. Runtime implementation belongs in the connected project.
Related: Types · Capabilities and contracts · Examples and scenarios
Home · Keyword index · Released source 36748015 · pr-44 package
Reference edition: October 7, 2026. Checked language examples do not establish implemented runtime behavior.