All languages
Osprey logo

Osprey languageexperimental

A functional language where failure is a `Result` value and outside work is a checked algebraic effect: the program's edge installs the handlers, so production code and its test doubles are the same code. It compiles through LLVM.

Overview

Osprey is a functional language built on algebraic effects: code asks for a disk, a log line or a clock with perform, and the program's edge decides what answers. It compiles through LLVM to native binaries, wasm32-wasip1 modules and C-ABI libraries for mobile hosts.

Code

let count: int = 42
let ratio = 3.5
let name = "Osprey"
let total = count * 2 + 1
let fits = total < 100
let label = fits ? "fits" : "over"
print("${name}: ${total} at ${ratio}, ${label}")
Slots run literals, collections, functions and unions, then the effects idiom that defines the language. writeLock takes no disk, so swapping full for disk changes only the boundary; removing both is a compile error, not a runtime one.

Distinctive traits

  • effect declares a need, perform asks for it, a handler answers it — and an unhandled request fails compilation.
  • Hindley-Milner inference everywhere, so annotations are optional and a redundant one is reported as a warning.
  • Arithmetic is total: +, -, * never trap, and overflow or division by zero become Arith effect operations a region handles.
  • Three surface syntaxes - Default, ML and Python-shaped - lower to one AST, and module signatures keep public types explicit.
  • LLVM output: native executables, wasm32-wasip1 modules and C-ABI mobile archives; memory is a per-build pick of tracing GC, ARC or unmanaged.
  • Fibers with buffered channels; the current runtime backs each fiber with its own OS thread.

Status

Pre-1.0 (v0.28.2, November 2026) and actively evolving; the project asks that workloads be validated before production use. MIT licensed, written in Rust, distributed through Homebrew and Scoop with a language server and VS Code extension.

Sources & references