Why Choose Zith?
Zith was designed to fill a gap in the systems programming landscape: a language that's as safe as Rust but simpler to learn and use.
The current prototype specification (Zith-spec.md, v2.0 architectural revision) formalizes the model around NRM, five ownership keywords, contexts/DSLs, packs, ECS/scenes, and concurrency rules.
The Problem with Current Options
| Language | Safety | Simplicity | Learning Curve | Ecosystem |
|---|---|---|---|---|
| C | ❌ Manual memory management | ✅ Simple syntax | Easy | Massive |
| C++ | ⚠️ Complex rules | ❌ Extremely complex | Very Hard | Massive |
| Rust | ✅ Excellent | ❌ Steep learning curve | Very Hard | Growing |
| Zig | ✅ Good | ✅ Simple | Moderate | Small |
| Zith | ✅ Strong | ✅ Intuitive | Easy | Emerging |
What Makes Zith Special
1. 🎯 Explicit Ownership Without Complexity
Zith's ownership model is visible in the type system, not hidden in borrow checker errors:
// Clear ownership modifiers
fn process(mut self: Health, dmg: view u16) {
// 'mut self' = I own and can modify
// 'view u16' = read-only reference
}
// No lifetime annotations needed
fn get_health(player: view Player): view u16 {
return player.health; // Safe, no lifetimes to specify
}
2. 🛡️ Compile-Time Safety Without GC
// Memory safety enforced at compile time
let health: unique u16 = alloc.new(100);
let ref: view u16 = health; // Borrow
ref += 10; // ❌ Compile Error: view doesn't allow mutation
health = 50; // ✅ OK: owner can still modify
// No garbage collector, no runtime overhead
3. 🧩 Start Simple, Scale When Needed
Zith grows with your project complexity:
Level 1: C-like Basics
fn add(a: i32, b: i32): i32 {
return a + b;
}
fn main() {
let result = add(5, 3);
print(result);
}
Level 2: Components & Entities
component Position {
x: i32,
y: i32,
}
component Velocity {
dx: i32,
dy: i32,
}
entity Player {
Position,
Velocity,
Health,
}
Level 3: Domain-Specific Languages
context SQL {
use infix = SQL.operators;
infix operator SELECT(cols);
infix operator FROM(table);
infix operator WHERE(condition);
}
use context SQL {
result = SELECT * FROM users WHERE age > 18;
}
4. 🔮 Safe DSLs with Contexts
Create embedded domain-specific languages without string parsing or injection vulnerabilities:
context QueryBuilder {
fn select(table: str, columns: [str]) -> Query;
fn where(query: Query, condition: Condition) -> Query;
}
use context QueryBuilder {
let query = select("users", ["name", "email"])
|> where(age > 18);
// Type-safe, no SQL injection possible
}
5. 🎬 Scenes for Resource Isolation
Perfect for games, simulations, and modular applications:
scene MainMenu {
resources: {
background: Texture,
buttons: [Button],
}
fn on_enter() { /* load menu */ }
fn on_exit() { /* cleanup */ }
}
scene GameLevel {
resources: {
world: World,
entities: [Entity],
}
fn update(dt: f32) { /* game logic */ }
}
// Automatic resource cleanup when scene changes
6. 🎮 Native ECS Support
Built-in entity-component-system for data-oriented design:
component Position { x: f32, y: f32 }
component Velocity { dx: f32, dy: f32 }
component Render { sprite: Sprite }
// System processes all entities with matching components
system movement_system(entities: [Entity with Position, Velocity]) {
for entity in entities {
entity.position.x += entity.velocity.dx;
entity.position.y += entity.velocity.dy;
}
}
Real-World Use Cases
✅ Perfect For:
- Game Engines - Native ECS, scenes, performance
- Embedded Systems - Zero overhead, predictable memory
- CLI Tools - Fast compilation, simple deployment
- Network Services - Safe concurrency, clear ownership
- DSLs & Compilers - Context system, pattern matching
- Learning Systems Programming - Gentle learning curve
⚠️ Consider Alternatives If:
- You need maximum ecosystem (C++/Rust)
- You want pure functional programming (Haskell/OCaml)
- You need garbage collection convenience (Go/Java)
- You're building web frontends (JavaScript/TypeScript)
Comparison with Rust
| Feature | Rust | Zith |
|---|---|---|
| Memory Safety | ✅ Borrow checker | ✅ Ownership types |
| Learning Curve | ⚠️ Very steep | ✅ Gentle |
| Syntax | Complex keywords | C-like familiarity |
| Lifetimes | Explicit annotations | Implicit through types |
| Error Handling | Result/Option | Similar + exceptions |
| Compile Time | Slow | Fast |
| Ecosystem | Large | Growing |
| Best For | Maximum safety | Balance of safety & simplicity |
Getting Started
Ready to try Zith? Here's your path:
-
Installation - Set up Zith in minutes
-
Quick Start - Write your first program
-
CLI Reference - Learn the tools
-
Language Guide - Deep dive
-
Spec Core Topics - Spec topic map
Zith proves you don't have to choose between safety and simplicity.