unique:** let resource: unique = Resource.new();share for intentional multiple owners:** implement Share and Clone explicitly.view for reading:** fn process(config: view Config)lend for temporary mutation:** fn update(state: lend GameState)belong for part-of relationships,** such as back-pointers.?...or for optionals:** let name = ?user.name or "guest";!...or for failables:** let config = !loadPrimary() or loadBackup() or defaultConfig();must for initialization:** const API_KEY = must env("API_KEY");context block.fail blocks and custom throw statements.let data = !step1() or step2() or step3() or AllFailed;If a function needs more than three specialized tools (markers, words, contexts, macros, comptime, inline error handling), something went wrong. Split the function or reconsider your abstraction.
// Good — two tools: marker + word
flow fn process() {
dock init { ... }
step1 -> step2
}
// Warning sign — four tools in one function
flow fn process() {
dock init { ... } // marker
use Math; // context
use assert AS CHECK; // word
risky()! // inline error handling
// Prefer: move the context/word usage to a wrapper function
}
The Rule of Three keeps code readable. Zith gives you many tools — you don't have to use them all at once.
| Construct | Convention | Examples |
|---|---|---|
| Variables & functions | camelCase | playerHealth, getDamage, loadConfig |
| Components | single word, lowercase | rgb, color, file, vertex, health |
| Structs | PascalCase | Point, Container, DynArray, GameConfig |
| Traits & interfaces | PascalCase | Printable, iPositioned (interfaces use lowercase i prefix) |
| Files | kebab-case | game-loop.zith, asset-manager.zith |
| Constants & comptime | UPPER_SNAKE_CASE | MAX_SIZE, PI, DEFAULT_TIMEOUT |
| Enums | PascalCase for the type; PascalCase for variants | enum Direction { North, South } |
Zith Language Specification — Draft v0.9