Gojo
Esc
  • Loading…
v0.0.1 beta · macOS, Linux

Memory-safe systems code,without the ceremony.

Ownership frees memory and rules out data races, with no lifetimes to annotate. Errors are values, every task lives in a scope, and it all compiles fast to C, then to one native binary.

Take the tour
Garbage collector
None
Null pointers
None
Lifetime annotations
None
Compiles to, then native
C
main.gojo
use std/os

struct Config {
    name: String // required
    port: int = 8080 // default value
    proxy: ?String // optional, defaults to none
}

fn load(path: str) -> Config ! os.Error {
    let text = try os.readText(path)
    Config{name: text.trim().toString()}
}

fn main() {
    let cfg = load("app.toml") catch e {
        eprintln("using defaults:", e)
        .{name: "app"}
    }
    let backups = [8081, 80, 9000]
        .filter(p => p > 1024)
        .map(p => ":${p}")
    println("${cfg.name} on :${cfg.port}, backups ${backups.join(", ")}, proxy: ${cfg.proxy ?? "none"}")
}

Structs with defaults, errors as values, optional fields and string interpolation, from the README.

Read it in the tour