Basics

Source text and names

.sd files are UTF-8. Strings/comments may contain Unicode; identifiers remain ASCII. All ordinary names, including types and variants, are lower snake case. Constants are upper snake case.

// ação and 日本語 are valid comment text
const MAX_ITEMS = 64
let greeting = "olá"

The literal has static borrowed type str. Owned valid UTF-8 uses string. len returns byte length; Unicode scalar/grapheme operations belong in libraries.

Bindings

let answer = 42
let mut count: usize = 0
let linear ticket = acquire_ticket()

Bindings are immutable by default. Mutation through a binding requires mut. linear creates an exactly-once consumption obligation.

Core types

Aggregates

struct point { x: i64, y: i64 }
let origin = point.{ x: 0, y: 0 }

type color { red green blue }
let selected = color.green

The clean compiler has no enum keyword; use a payload-free ADT. Raw unions require unsafe construction/access.

Expressions

Blocks, if, and match yield values. Use the final expression for an implicit result and ret for early return. Integer arithmetic follows the deterministic rules in SEMANTIC_RULES.md; safe indexing remains checked in release builds.

The clean compiler implements typed phase-1/2 f"..." interpolation for text, bool, integers, floats, format specifications, and static display/debug traits. Use {{/}} for literal braces and .to_string()? only when an owned contiguous string is required. Printing remains an explicit library operation.