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
- integers:
i8…i64,u8…u64,isize,usize;bytealiasesu8 - floats:
f32,f64 - control:
bool,void,never - text/buffers:
str,string,bytes,shared_bytes - compound: arrays
[n]t, slices[]t/mut []t, tuples, structs, ADTs, unions, options, results, function values, pointers, generics,linear t
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.