Functions
fn add(a int, b int) int {
<< a + b
}
fn (c $&Counter) inc() {
c.n += 1
}
Variadic is trailing name <-> T, seen as []T in the body. Errors are not extra return values; they use >> + >>> (err).
In expressions << / >> remain shifts; as statements they return/throw; >>> propagates & handles errors. Boolean or is ||. Division by zero and out-of-bounds index fail loud.
Generic Type Parameters
Declare type parameters after # in the function name; calls are monomorphized from their arguments. 0.9.4 removes the four-type-parameter limit on generic declarations:
fn fifth#A,B,C,D,E(a A, b B, c C, d D, e E) E {
<< e
}
// fifth(1, true, 3.0, "four", 5) returns 5
See the generics tutorial for method-set constraints and dynamic boxes.
Error syntax migration (0.15.0)
Xu 0.15.0 removed legacy or error handlers (or (err) { } and or >>). They now trigger a hard parser error directing users to >>> (err) { } and >>> (while >> expr throws errors). or is now a normal identifier (boolean OR uses ||), and xu-lsp provides a quick-fix code action to migrate legacy syntax; see VS Code / Cursor LSP code actions.