As fast as C
LLVM compiles every program, with no runtime and no hidden copies. inout parameters cannot alias, so they are marked noalias.
Every value has one owner. Functions borrow their arguments, borrow them to change them, or take them, and a small kernel makes sure nothing changes what is borrowed. No garbage collector, no reference counting, no annotations.
curl -L https://github.com/jihoo-language/jihoo2/releases/download/v0.4.1/jihoo-v0.4.1-x86_64-linux.tar.gz | tar xzfn greet(name: str) -> String {
"Hello, " + name + "!"
}
fn main() {
println(greet("jihoo2"))
}fn main() {
var v = Vec(i64).new()
v.push(1)
for x in v {
v.push(x)
}
}enum Expr {
Num(i64)
Add(Box(Expr), Box(Expr))
Mul(Box(Expr), Box(Expr))
}
fn eval(e: Expr) -> i64 {
match e {
Num(n) => n
Add(a, b) => eval(a) + eval(b)
Mul(a, b) => eval(a) * eval(b)
}
}#![freestanding]
fn main() {
var v = Vec(i64).new()
v.push(42)
println(v[0])
}A language for programs that must be fast and correct: compilers, kernels, tools and the libraries under them.
LLVM compiles every program, with no runtime and no hidden copies. inout parameters cannot alias, so they are marked noalias.
Borrows are scoped to a function, so the compiler sees every one of them and needs no annotations. A separate borrow kernel checks the rules on the compiler’s IR, without trusting the type checker.
comptime T: type parameters, inferred at calls, with traits as bounds. One copy of the code per instance, checked per instance.
#[no_alloc] and #[no_panic] are checked through calls. Certified slice accesses establish their bounds at compile time.
Raw pointers, C functions, system calls, atomics and volatile access. Native, freestanding and UEFI programs for x86_64 and aarch64.
Vec, String, Map, Box, sorting, files, processes and threads are jihoo code, with or without libc. Errors carry an os.Error, and iterator pipelines fuse into loops.
jihoo fmt, jihoo test, jihoo check with JSON diagnostics, and jihoo lsp for editors. The compiler is written in jihoo and builds itself to the same IR.
Borrows last for a call, so the compiler sees all of them. Values that own memory move, and .clone() copies them.
The default. The function reads the value; the caller keeps it. No copy.
fn total(xs: Vec(i64)) -> i64 {
var s = 0
for x in xs { s += x }
s
}Changes the caller’s value in place, written f(&v) at the call. Never aliased.
fn add_one(inout xs: Vec(i64)) {
for i in 0..xs.len() {
xs[i] += 1
}
}Moves the value into the function. The caller can no longer use it.
fn keep(sink s: String) -> Box(String) {
Box.new(s)
}The borrow kernel does not trust the type checker: it checks loans again on MIR, where every access is explicit.
Download a release for x86_64 or aarch64 Linux: the compiler and its standard library, which need only glibc and LLVM 23.