Skip to content

Gossamer

A goroutine-powered, fast-compiling language with Rust-flavoured syntax and a Go-shaped runtime. Memory is automatic and deterministic - a Swift-like model of reference counting (with automatic cycle collection) plus arena { } regions, and no tracing collector.

Gossamer is pre-1.0.0, so the public API may still change before 1.0.

Hello, Gossamer

fn main() {
    println!("hello, world")
}

For scripts and examples, the entry file may skip the fn main wrapper: bare statements at file scope become the body of an implicit fn main(), so this is a complete program too:

println!("hello, world")

See Top-level statements.

Hello, Goroutines and Channels

use std::sync::channel

fn add(a: i64, b: i64) -> i64 { a + b }

fn main() {
    let (tx, rx) = channel::<i64>()
    go fn() { tx.send(40 |> add(2)) }()
    if let Some(answer) = rx.recv() {
        println!("answer: {}", answer)
    }
}

A Script, No Boilerplate

No fn main, no ceremony - the file's top-level statements are the program. Sequence combinators are methods on any Vec or range, so a data-processing script reads top to bottom:

let nums = [4, 8, 15, 16, 23, 42]
println!("sum of evens: {}", nums.filter(|n| n % 2 == 0).sum())

See Top-level statements.

Why Gossamer

  • Ergonomic - Forward pipes, Rust-like error handling, minimal magic.
  • Efficient - a small memory footprint, near-instant startup on the bytecode VM for a quick edit-run cycle, and native compiled execution when you ship a binary.
  • Interpreted and Compiled - Develop code quickly with a bytecode vm powered interpreter and a REPL. Ship an optimized compiled single binary.
  • Portable - Tier 1 execution on Linux (x86_64 and aarch64, including Raspberry Pi OS 64-bit), Apple Silicon macOS, and Windows x86_64. Linux-musl AOT deployment is Tier 2 with QEMU-backed VM differential evidence. See the supported target matrix for artifact-only and unsupported registered triples.
  • Go-style goroutines - (go expr) with typed channels.
  • Go-style async - Colorless functions and stackful coroutines.
  • Rust-style type system - statically-typed, generics with trait bounds, pattern-matching, Option<T> / Result<T, E>.
  • Swift-like memory model - deterministic reference counting (closely modeled on Swift's ARC, with automatic cycle collection added) plus arena { } regions reclaim values as the last reference dies. No lifetimes, no borrow-checker surface, no tracing collector.
  • Extensible in Rust - Write libraries in safe Rust.

Where to go next

  • Install - build from source today, prebuilt binaries coming with the 1.0.0 release.
  • Running - gos cheat-sheet.
  • Syntax - grammar tour with worked examples.
  • Memory model - how values, references, and automatic memory management fit together.
  • Writing libraries - project.toml, module layout, publishing.
  • Standard library - module index.
  • Prelude - everything available without imports.
  • Toolchain - every subcommand.

Coming from another language? Start with the migration guide for Rust, Go, Python, Kotlin, or F# - each maps what you already know onto Gossamer.