As fast as C
LLVM compiles every program, with no runtime and no hidden copies; on
the benchmarks jihoo matches C compiled by clang, with bounds checks on.
inout parameters cannot alias, so the compiler marks them noalias.
fn greet(name: str) -> String { "Hello, " + name + "!"}
fn main() { println(greet("jihoo"))}fn total(xs: Vec(i64)) -> i64 { ... } // reads, no copyfn add_one(inout xs: Vec(i64)) { ... } // changes in place: add_one(&v)fn keep(sink xs: Vec(i64)) { ... } // takes it
for x in v { v.push(x) // error: `v` is changed here while it is borrowed}#![freestanding]
fn main() { var v = Vec(i64).new() v.push(42) println(v[0])}As fast as C
LLVM compiles every program, with no runtime and no hidden copies; on
the benchmarks jihoo matches C compiled by clang, with bounds checks on.
inout parameters cannot alias, so the compiler marks them noalias.
Safe without lifetimes
Borrows are scoped to a function, so the compiler sees every one of them and needs no annotations. A small checker, separate from the type checker, enforces the rules on the compiler’s IR.
Generics at compile time
comptime T: type parameters, inferred at calls; traits with default
methods and generic impls; one copy of the code per instance.
A library in the language
Vec, String, Map, Box, sorting and files are jihoo code over
unsafe pointers, and work with or without libc.
Down to the metal
Raw pointers, static globals, C functions, system calls and atomics in
unsafe code; x86_64 and aarch64 Linux.
Built with Nix
nix run github:jihoolang/jihoo gives you the compiler, clang, lld and the
standard library.