Familiar to write.
Honest about cost.
Joule reads like a modern compiled language. What is different is that energy is a first-class output. The same source that gives you types and pattern matching also tells you what a function costs to run.
Core language
A static type system with local inference. Types are checked before anything runs, and most annotations are optional where the compiler can work them out.
let temps: [f32] = [21.4, 22.1, 20.8] let count = temps.len() // inferred: usize let label = "sensor-{count}"
Match on algebraic data types with exhaustiveness checking. The compiler flags a missing case, so error and edge paths are handled by construction.
match sensor.read() { Reading::Ok(v) => process(v), Reading::Err(e) => log(e), Reading::Timeout => retry(), }
Write a function once and reuse it across types with bounds. Abstractions compile away, so generic code carries no runtime tax.
fn max_by<T: Ord>(xs: [T]) -> T { let mut best = xs[0] for x in xs { if x > best { best = x } } return best }
Attach an energy ceiling to a function. The build reports actual against budget in the receipt, so a regression shows up as a number, not a surprise.
// annotate a ceiling; the build checks it @energy(max: 50_uJ) fn resample(sig: [f32]) -> [f32] { // receipt reports actual vs budget }
Energy awareness
Energy is attributed to each function and operation, so a hot spot reads as joules rather than a guess about which loop is expensive.
Set a ceiling on a function or module. The build reports where a run lands against its budget, so limits are visible where you set them.
Each build emits a breakdown by compute, memory, and I/O, plus the hottest functions. Diff two builds to see exactly what a change cost.
Because Joule compiles to C, the same source produces native binaries across architectures, and the cost view travels with it.
Compiles to C
Joule lowers to portable C and hands off to your system C compiler. You get a fast native binary, and your program runs anywhere a C compiler does, from a laptop to a microcontroller.
Proven by construction
The strongest evidence that a language is real is that its own compiler is written in it. Joule's compiler compiles itself to C and reaches a byte-identical fixed point, and a corpus of over 514 programs keeps that result honest on every build.