hn.today

The Goose Programming Language

aardappel.github.io174 points1 comments
Screenshot of The Goose Programming Language

Goose is a systems programming language built around a memory model with no heap allocator, garbage collector, reference counting, or lifetime annotations. Dynamic values live inline on compiler-managed data stacks; growing a value advances a pointer, and leaving its scope frees its storage with a single update. Because memory does not move during growth, references into arrays remain valid. The compiler tracks what each reference depends on and rejects uses that could outlive the value it points into, without requiring programmers to write lifetime annotations or follow Rust-style aliasing rules.

The design emphasizes compact layouts and direct construction. Nested strings, arrays, and records can occupy one contiguous block, while variable-sized enums store only the space their active variant needs. Narrow relative links support position-independent structures that can be saved as bytes and checked when loaded. Values are built at their final destination, errors can return across multiple calls, and threads exchange copied values through typed queues rather than shared memory. Goose also offers generics and compile-time function values, compiles to C, and can call C directly. Its benchmark suite reports that Goose outperforms idiomatic C++, hand-optimized C++, and safe Rust on average across sixteen tests while using less memory; the documentation also includes cases where Goose loses. One trade-off is that arrays of variable-sized elements are sequential rather than directly indexable.

Read on aardappel.github.io1 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.