Dusk

self-hosting · v1.11.0

A systems language for programmers who like things explicit.

Dusk compiles to textual LLVM IR you can open in an editor. Immutable by default, memory that faults loudly instead of corrupting silently, errors you can't ignore, and paradigms you mix per file.

Get started Open the playground paru -S dusk-lang-git
main.dusk
@paradigm functional

func main() -> int32 {
    nums: int64[] = [1, 2, 3, 4, 5]
    doubled := map(nums, lambda (n: int64) -> int64 {
        return n * 2
    })
    foreach(doubled, lambda (n: int64) -> void {
        println(n)
    })
    return 0
}
main.ll, what the compiler emits
define i64 @lambda.0(ptr %env, i64 %a0) {
entry:
  %t0 = alloca i64
  store i64 %a0, ptr %t0
  %t1 = load i64, ptr %t0
  %t2 = mul i64 %t1, 2
  ret i64 %t2
}

define void @lambda.1(ptr %env, i64 %a0) {
entry:
  %t0 = alloca i64
  store i64 %a0, ptr %t0
  %t1 = load i64, ptr %t0
  call void @cool_println_i64(i64 %t1)
  ret void
}

The exact IR Dusk 0.3.3 emits for the program on the left, trimmed to the two lambdas. n * 2 is the mul; clang links the rest against a small C runtime. See your own program's IR →

0-6° · civil twilight

Paradigms stack per file

A file declares the paradigms it uses with @paradigm, and they stack. You mix procedural, functional, and oop as needed, and only what you declared exists there. A file reads the way it says it will.

6-12° · nautical twilight

Errors are values

A fallible function returns (value, error), and an unhandled error stops the compile. No runtime surprise three weeks later.

12-18° · astronomical twilight

Memory faults, never corrupts

Every managed pointer carries a generation checked at each dereference. Use-after-free, double free, and stale pointers fault by name.

Three phases of Dusk, from source down to the metal.

Monomorphized generics

Generic functions and types specialize at compile time. No runtime type resolution, ever.

Interfaces, no inheritance

Vtable dispatch through interfaces; printing goes through Display or fails to compile.

C in both directions

Dusk calls C: variadic functions, third party libraries, structs by value, your own functions handed over as callbacks. C calls Dusk: export "C" and dusk build --lib emit a static archive and a header.

Concurrency that faults by name

Threads, bounded channels, mutexes, and a thread pool. Every classic pthread misuse faults with its name, not undefined behavior.

Packages are git repositories

Dawn fetches Go-style imports like "github.com/user/repo/module" into a local cache. No registry to gatekeep.

A toolchain you can hold

A self-hosting compiler written in Dusk, a small C runtime, and thirteen CLI commands that mirror the pipeline.

Get Dusk

# on Arch Linux, from the AUR
paru -S dusk-lang-git
yay -S dusk-lang-git

# any x86_64 Linux machine, from a release artifact
tools/bootstrap.sh dusk.ll.xz

You'll need clang and LLVM 22.x on your path, since Dusk emits one LLVM major version's textual IR. Dusk is self-hosting and past 1.0: the compiler is written in Dusk itself, the Rust seed that bootstrapped it is archived, and the surface is growing again, so the roadmap says where it's headed. Then take the first steps or skim the language tour.