Basics

Source text and names

.sd files are UTF-8. Strings/comments may contain Unicode; identifiers remain ASCII. Value names (functions, variables, fields, modules) use lower snake case; nominal types (structs, enums, unions, traits, generic params) and variants use UpperCamelCase; 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 }

enum Color { Red Green Blue }
let selected = Color.Green

enum defines ADTs including payload-free enumerations. Raw unions require unsafe construction/access.

Expressions

Blocks, if, and match yield values. Use the final expression for an implicit result and return 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.