Gossamer: a Rust-flavoured language with real goroutines and pause-free memory

mwheeler1 pts0 comments

Gossamer - a Rust-flavoured language with real goroutines and pause-free memory

Why Gossamer

Expressive and clear syntax

Forward pipes (|>), immutable by default,<br>and one obvious way to do things. Data flows top-to-bottom,<br>the way you wrote it — not nested inside-out.

Automatic memory, no GC pauses

Deterministic reference counting plus arena { }<br>regions reclaim memory the moment it's done. No borrow<br>checker, no lifetimes, no stop-the-world collector.

Real goroutines, colorless functions

go and typed channels on an M:N scheduler.<br>Blocking calls park the goroutine, not the thread. No<br>async, no await, no function<br>colouring.

Run it, or ship it

A bytecode VM and a REPL for fast iteration; a single,<br>dependency-free native binary via LLVM when you ship. Same<br>language, your choice of tier.

Familiar types, fewer surprises

Result / Option / ?,<br>exhaustive match, traits, generics, and no<br>null. If you know Rust, Go, or F#, you can<br>already read it.

Batteries included, extensible in Rust

A broad standard library — HTTP, JSON, crypto, SQL,<br>compression, and more — and a clean path to drop down<br>into safe Rust when you need it.

See it in a few lines

Hit Run on any sample — it executes right in your browser, no install. Gossamer's VM is compiled to WebAssembly.

Forward pipes<br>Web routing<br>Goroutines<br>ADTs and Matching

fn double(x: i64) -> i64 { x * 2 }<br>fn add(a: i64, b: i64) -> i64 { a + b }<br>fn clamp(lo: i64, hi: i64, x: i64) -> i64 {<br>if x hi { hi } else { x }

fn main() {<br>let n = 3 |> double |> add(10) |> clamp(0, 100)<br>println!("answer: {}", n)

// A request router - the heart of a web service, runnable right here.<br>fn route(method: &String, path: &String) -> String {<br>if method == &"GET" && path == &"/" { "200 Gossamer" }<br>else if method == &"GET" && path == &"/health" { "200 ok" }<br>else if method == &"POST" && path == &"/users" { "201 created" }<br>else { "404 not found" }

let requests = [("GET", "/"), ("GET", "/health"), ("POST", "/users"), ("GET", "/x")]<br>for (m, p) in requests {<br>println!("{} {} -> {}", m, p, route(&m, &p))

fn fib(n: i64) -> i64 {<br>if n println!("fib(30) on a goroutine = {}", v),<br>Err(e) => eprintln!("worker failed: {}", e),

use std::strings

enum Shape {<br>Circle(f64),<br>Rect { w: f64, h: f64 },<br>Triangle(f64, f64),

fn area(s: &Shape) -> f64 {<br>match s {<br>Shape::Circle(r) => 3.14159 * r * r,<br>Shape::Rect { w, h } => w * h,<br>Shape::Triangle(b, h) => 0.5 * b * h,

// Top-level statements - no fn main() needed<br>let shapes = [Shape::Circle(3.0), Shape::Rect { w: 4.0, h: 5.0 }, Shape::Triangle(6.0, 2.0)]<br>for s in shapes {<br>println!("area = {:.2}", area(&s))

Coming from another language?

Short, focused guides that map what you already know onto<br>Gossamer.

From Rust &rarr;<br>From Go &rarr;<br>From Python &rarr;<br>From Kotlin &rarr;<br>From F# &rarr;

Get started

Write a .gos file and run it with the<br>gos toolchain — no build step needed while<br>you iterate:

$ gos run hello.gos<br>hello, gossamer

$ gos build --release hello.gos # one native binary, ready to ship

Runs on Linux (x86_64, aarch64, armv7), macOS (Intel &<br>Apple Silicon), and Windows (x86_64).

Install &rarr;<br>Read the docs

Gossamer is open source under the Apache-2.0 license. Pre-1.0 — the surface is stable to write against.

gossamer shape rust from rarr path

Related Articles