Documentation

Learn how to write energy-efficient code with Joule.

Getting Started

# Install Joule
curl -sSf https://joule-lang.org/install.sh | sh

# Create a new project
joule new my-project
cd my-project

# Build and run
joule build
joule run
View installation options →

Memory Safety

Joule uses ownership and borrowing for memory safety without garbage collection.

// Ownership - each value has exactly one owner
let data = Vector::new([1, 2, 3, 4, 5]);
process(data);       // Ownership transferred
// data no longer accessible here

// Borrowing - temporary access
let data = Vector::new([1, 2, 3]);
analyze(&data);      // Immutable borrow
data.push(4);        // Still accessible

Language Features

A modern type system with inference, pattern matching, and algebraic data types.

// Pattern matching with exhaustiveness checking
enum Result<T, E> {
    Ok(T),
    Err(E),
}

match result {
    Ok(value) => process(value),
    Err(error) => handle(error),
}

Variables and Types

Full type inference with static checking

Functions and Closures

First-class functions with capture

Pattern Matching

Exhaustive matching with guards

Generics and Traits

Zero-cost generic programming

Error Handling

Result and Option types, no exceptions

Macros

Hygienic compile-time metaprogramming

Energy Features

Joule's unique energy-aware features let you write code that's both fast and efficient.

// Energy budget as a function attribute
#[energy_budget(max_joules = 0.001)]
fn process_data(input: Vec<f64>) -> f64 {
    let sum = input.iter().sum();
    sum / input.len() as f64
}

// Thermal-aware code with automatic adaptation
#[energy_budget(max_joules = 0.002)]
#[thermal_aware]
fn compute(n: i32) -> i32 {
    let result = n * n;
    result + 1
}

Energy Budgets

Compile-time energy bound checking

Hardware Telemetry

Intel RAPL, ARM Energy Probe integration

Thermal Awareness

Automatic adaptation to CPU temperature

Energy Profiling

Built-in energy measurement tools

Standard Library

Comprehensive modules for systems programming, scientific computing, and more.

core

Primitives & traits

std

Collections & I/O

energy

Budgets & metering

gpu

Heterogeneous compute

Try Joule

See how Joule compares to other languages in our interactive benchmark.

Open Benchmark →