Features

What makes Reef different.

Reef is not competing on speed. It is worth writing about because it combines three things that rarely appear together: the Active Object concurrency model from Oberon, the expressiveness of Ruby and Crystal, and native compilation that runs anywhere from userland to bare metal.

Active Objects

Active Objects come from A2 Oberon and two decades of research at ETH Zürich. Each Active Object owns its state and guards it with a lock, so concurrent access is synchronized by the language rather than by programmer discipline.

exclusive methods hold the write lock and are mutually exclusive; shared methods hold a reader lock and may run concurrently. The compiler rejects any attempt to mutate the object's state from a shared method — so the result is data-race freedom for Active Object state, enforced at compile time.

An Active Object that declares a run() method gets its own background thread; objects without one are ordinary synchronized objects. The guarantee is scoped to Active-Object-owned state: module-level mutable variables are unsynchronized by design, and the compiler warns when an Active Object touches one.

See it end to end in the examples library — the concurrent hasher spreads work across worker Active Objects, each with its own thread, with no locks in user code.

Passive Objects

0.9 adds heap classes with single inheritance and virtual methods. A passive object is not an Active Object: no monitor, no run() thread, no await.

extends / override / inherited build a hierarchy; typecase dispatches on the dynamic type. Use a struct for a record, a passive object for a widget tree, an Active Object when the thing is the concurrency boundary.

object Widget
    id: string
    shared fn kind(): string
        return "widget"
    end kind
end Widget

object Label extends Widget
    text: string
    override shared fn kind(): string
        return "label"
    end kind
end Label

Walkthrough: Passive Objects. Working program: the Objects entry in the examples library.

The language

Modern type system

Statically typed, with generics by monomorphization, sum types, traits, closures with escape analysis, and pattern matching with guards and exhaustiveness checking. The type checker catches the mistakes before code generation ever runs.

Syntax built for people

End-based blocks, string interpolation, and readable declarations — close to Ruby and Crystal in feel. The surface is built for people, not for parsers.

Compiles to readable C

A lexer, parser, type checker, and code generator produce readable C, which GCC or Clang compiles to native executables. No VM and no runtime dependency — the same toolchain path, and the same optimizer, that C code takes. Verify it with reefc --emit-c.

Portable C99 runtime

A portable C99 runtime with no Virtual Machine. Its mark-and-sweep collector marks concurrently and sweeps lazily — application threads keep running while it marks — and scans the stack precisely through a shadow-frame chain, so it knows exactly which slots hold pointers rather than guessing conservatively.

Standard library

20 packages, 158 modules — batteries that ship with the compiler, all written in Reef.

Core & collections

Collections, I/O and filesystem, text processing.

Encoding

JSON, YAML, TOML, CSV, MessagePack, base64.

Hashing

SHA-256, SHA-1, MD5, HMAC, CRC32.

Compression

gzip, zlib, zip, lz4.

Networking

TCP, UDP, Unix sockets, DNS, HTTP, TLS.

ReefVision

Desktop shell and widgets as a passive-object hierarchy.

TLS backend

Builds against the OS-provided OpenSSL 3.x; Reef bundles no third-party libraries.

Systems & bare metal

Because Reef compiles through C, it reaches down to the hardware. It supports inline assembly for AMD64, ARM64, and RISC-V, and can build freestanding for operating-system development.

The reef-os library provides the primitives kernel work needs: CPU primitives, serial drivers, spinlocks, and Limine bootloader support. A freestanding Reef kernel boots to a serial banner under QEMU — the boot transcript is in the examples library.

Platforms

Linux · macOS · FreeBSD · OpenBSD · NetBSD · illumos

See it running.

Browse examples Install Reef