Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

gossamer

> 编程语言
Open source

The Gossamer programming language and tooling

170 stars0 likes0 views
WebsiteGitHub

About

The Gossamer programming language and tooling

Gossamer

Homepage and docs

Try it out

Take the tour

North Star Goals

  • Trustworthy (Stable, Secure, Correct)

  • Ergonomic (Concise, Expressive, Understandable)

  • Performant (Fast, Efficient, Scalable)

Central Thread

Tier parity: Interpreted or compiled logic behaves the same.

Current Status

In heavy development. Core elements of the language may change or break.

My goal is a language stable enough for 1.0.0 (and beyond).

Contributing

See CONTRIBUTING.md for details on Github Issues, PRs, and the LLM policy.

Motivations

Why build Gossamer? Why use it?

My inspirations tell the story:

I love the confidence that comes from Rust and F#: the feeling that if it compiles, it probably works. Algebraic data types, pattern matching, and explicit error handling feel like a natural way to build correct and maintainable software.

From Python, having a REPL open or being able to iterate quickly on a script without waiting for a compile step.

Go, meanwhile, is an incredible tool for building and shipping software. It feels fast, minimal, and frictionless. The extensive standard library let's you be productive quickly.

Zig's approach to metaprogramming via comptime, C#'s top level statements, Java's experimental approach to structured colorless concurrency all appeal.

Swift's approach to garbage collection with ARC strikes a powerful balance.

A Single Language?

What if one language could combine all of those ideas?

What if I could iterate quickly in a REPL or script, then compile the exact same program into an optimized standalone binary with no code changes?

What if that language could perform Python like while interpreted, but closer to Go when compiled?

I built Gossamer because I wanted that language for myself.

My goal is for Gossamer to replace Go, Python, F#/C#, Kotlin/Java, and (some) Rust for most of my own projects and use cases.

Features inspired by multiple languages:

Feature Gossamer Rust Go F# Python Elixir Kotlin
Strong static type system ✓ ✓ ✓ ✓ ✓
Algebraic data types / discriminated unions ✓ ✓ ✓
Exhaustive pattern matching ✓ ✓ ✓ ✓ ✓
Error handling via ? with Result & Option ✓ ✓
No null by default ✓ ✓ ✓ ✓ ✓
Immutable by default ✓ ✓ ✓ ✓ ✓
Reference mutability and escape checks ✓ ✓
Automatic memory management ✓ ✓ ✓ ✓ ✓ ✓
Small portable binaries ✓ ✓ ✓ ✓
Pipe operator (|>) ✓ ✓ ✓
Interpreted / scripting mode ✓ ✓ ✓ ✓ ✓
Interactive REPL ✓ ✓ ✓ ✓ ✓
Keyword arguments ✓ ✓ ✓ ✓ ✓
Default argument values ✓ ✓ ✓ ✓ ✓
Built in MCP server ✓ ✓

Not Transpiled

Gossamer compiles directly to native, it does not transpile to Rust or Go.

No Macros

No user-defined macros. Metaprogramming is Zig-style comptime: code runs during compilation and folds into the program, and a for loop over typeInfo::() reflection generates native per-field code.

Gossamer is Extensible in Rust.

Gossamer is built to extend simply via (synchronous) Rust.

Features unique to Gossamer

Or at least - not a carbon copy by intent!

Default colorless structured concurrency

As of 0.51.0 - Gossamer supports and defaults to colorless yet structured concurrency.

Tier Parity Across Interpreted/Compiled

Bit-identical semantics across VM / JIT / AOT treated as a release gate.

The code you run in the REPL, as a script, as a debug binary, and as an optimized release binary behaves the same as an explicit language goal.

Memory: Automatic, Deterministic, with Checked Regions Gossamer's automatic memory management uses deterministic reference counting, and features checked regions. No lifetime ceremony.

Commas or Newlines

For structs, enums, match branches, function arguments & parameters, use commas for single line, and newlines for multi-line. This gives a consistent and cleaner look. (Optional - gos fmt will clean this up).

Collection Literals

Inspired by Clojure here (#{} for set):

Collection Empty With Data
Fixed Array [] [1,2,3]
Vec #[] #[1,2,3]
Map {} {"one": 1, "two": 2, "three": 3}
Set #{} #{1,2,3}
Tuple () (1, "two", 3.0)

Distinct Types for Queue, Stack, MinHeap, MaxHeap

Gossamer implements distinct types here instead of reusing existing structures.

Typically:

  • MinHeap: MaxHeap with Reverse (or similar)
  • Stack: Vec with specific method usage
  • Queue: Deque with specific method usage

This enables having a stronger type contract as well as making it more convenient to write.

If I want to know an argument to a function only allows LIFO behavior - I'd use Stack over Vec.

If I want a MinHeap - I can create it and use push/pop without worrying about making the number a negative, or using "Reverse" to wrap it.

Of course you can still use the other structures - but the recommended course of action is to use the dedicated ones.

Collection Empty With Data
MaxHeap MaxHeap::new() MaxHeap::from([1,2,3])
MinHeap MinHeap::new() MinHeap::from([1,2,3])
Queue Queue::new() Queue::from([1,2,3])
Stack Stack::new() Stack::from([1,2,3])
Deque Deque::new() Deque::from([1,2,3])

Wrapping arithmetic operators

a +% b, a -% b, and a *% b add, subtract, and multiply.

+%=, -%=, *%= for compounding.

Details

  • Language spec: SPEC.md
  • Project style guide: GUIDELINES.md
  • AI skill card: SKILL.md - drop this file into a model's context to teach it how to write idiomatic Gossamer (also embedded in gos skill-prompt).
  • Editor integrations: gossamer-lang/gossamer-editor-support (VSCode, Vim, Neovim, Helix, Emacs, Sublime, Zed, plus a tree-sitter grammar)

Source files use the .gos extension.

The CLI is gos.

Manifests live in project.toml.

Pre-stable. gos feature-status distinguishes available Shipped surface from compatibility-protected Stable surface. Until entries are explicitly promoted to Stable, treat them as may-change-with-notice.

Packages, Modules, and Visibility

A package is the unit of distribution: one project.toml, one project id, the thing gos add pulls in. A module is a directory of source under src/ - src/util/mod.gos is module util. A module nested inside another is a module descendant: src/deep/nest/ is deep::nest, a descendant of deep.

Visibility is defined against those three. An item with no annotation is private to the module that declares it and to that module's descendants, as in Rust. pub(package) widens it to every module of the declaring package and no further. pub makes it part of the package's public API. Methods and struct fields carry their own visibility, so a pub type can keep private helpers and a private representation.

Full rules: visibility and SPEC §6.3a.

On Mutability and Ownership

The broad goal is be inspired by Rust, but not as strict. Gossamer uses a conservative lexical borrow checker rather than Rust's ownership and lifetime system. References have implicit lifetimes ending at the closing brace, and safe Gossamer has no explicit lifetime annotations. Bindings are immutable by default, and a function can mutate caller-owned data only through a mutable reference.

Parity and the REPL

Tier parity between interpreted Gossamer and compiled Gossamer is a primary language goal.

This extends to the REPL as much as practical. Because top-level REPL bindings share one persistent scope, a reference would otherwise protect its source for the rest of the session. %drop NAME ends and removes that binding's lexical lifetime while preserving completed mutations and later independent bindings.

Gossamer's Syntax

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:

gossamer
println("Hello World")

A top-level ? makes the implicit main return Result; set a process exit code with std::process::exit(n).

Gossamer has a forward-pipe operator (|>) for composing free functions, which have no receiver to chain from. x |> f is f(x); a step that writes arguments is a closure whose parameter is that slot, so x |> |v| f(a, v) is f(a, x) and x |> |v| g(v, a) is g(x, a). Anything with a receiver already chains, and the method chain is the shorter spelling - the two mix freely:

gossamer
use std::{iter, strings}

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

fn main() {
    // 3 -> double -> add 10 -> clamp to [0, 100]
    let n = 3 |> double |> |v| add(10, v) |> |v| clamp(0, 100, v)
    println("arithmetic: {}", n)

    // A method chain is an ordinary operand, so it can feed a pipe.
    let words = "  Hello  World  ".to_lowercase()
        |> strings::split_whitespace
        |> iter::count

    println("words: {}", words)
}

Types define their own operators. impl Add for T gives + its meaning, and the same shape covers -, *, [], and the rest. Structural == and .clone() are automatic - no derive needed - so a custom operator is the part that is genuinely yours to write:

gossamer
struct Vec2 { x: f64, y: f64 }

impl Add for Vec2 {
    fn add(self, o: Vec2) -> Vec2 { Vec2 { x: self.x + o.x, y: self.y + o.y } }
}

fn main() {
    let sum = Vec2 { x: 1.5, y: 2.0 } + Vec2 { x: 3.0, y: 4.0 }
    println("({}, {})", sum.x, sum.y)   // (4.5, 6)
    println("{}", sum == sum.clone())   // true
}

A goroutine + channel example:

gossamer
use std::sync::channel

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

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

Or spawn a goroutine and join its result - Ok(value), or Err(message) if it panicked:

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

fn main() {
    let h = spawn(|| 40 |> |v| add(2, v))
    match h.join() {
        Ok(v) => println("answer: {}", v),
        Err(e) => println("worker failed: {}", e),
    }
}

A cohort { } owns the goroutines started inside it: the block cannot be left until every one of them has finished, and a child's failure cancels its siblings and becomes the block's Result.

gossamer
use std::errors

fn fetch(name: String) -> Result { Ok(name) }

fn gather() -> Result {
    cohort {

Issues· 1 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustcompilergossamerinterpreted-programming-languagelanguage

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言