Urgent.News

What's breaking now, across thousands of outlets.

Tech

The Goose Programming Language

Goose is a memory-safe systems programming language that eliminates the need for a heap allocator, garbage collector, or lifetime annotations. In Goose, every dynamic value lives inline on a data stack managed by the compiler, resulting in faster execution and lower memory usage compared to languages like C++ and Rust.

The language syntax is familiar to C and Rust programmers, but it employs a unique approach to memory management. Every dynamic value is stored inline on a data stack, which is a large address-space reservation with a bump pointer. This design ensures that memory is freed when its scope ends, and there is no need for manual memory management.

Goose's type and lifetime rules guarantee the safety of the memory model. The compiler infers roots and specializes functions for them, eliminating the need for annotations. The language's static nature allows for compile-time proof of memory safety, with the runtime only tracking bump pointers.

Stable references are used to account for benchmark gains, ensuring that every reference and slice has a static root. This eliminates the need for additional memory management and provides a way to link elements while building arrays. However, resizable vectors, such as Vec<T>, cannot guarantee the same level of performance.

Goose's type system includes algebraic data types (ADTs), which provide dynamic polymorphism without the need for inheritance or vtables. ADTs can be stored in two ways: fixed mode (Shape) or variable mode (Shape..). The fixed mode provides a tag plus room for the largest payload, while the variable mode gives each value exactly its variant's size, allowing for sequential storage and reference access.

The language also supports transparent references, which do not require the use of *, - operators. Bind or retarget references using .=, and handle nullable references using Node?. The insert operation in a binary search tree is simplified, requiring only a push and a store, and the runtime tracking ensures position independence.

Goose's design allows for copy-free construction, where a constructed value is always built in its final home. Functions returning grow-only arrays by value write their elements directly into the caller's variable or into a field of the record being built, eliminating the need for out-parameters. The language is fully monomorphized, with type arguments inferred from argument types.

Written by urgent.news from Hacker News's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Also reported by 1 other outlet

Read the original at aardappel.github.io →

More in Tech

Tim Pan’s iPhone Duo Review

I hadn’t heard of Tim Pan or Mediastorm until running across his 24-minute video review of the Duo. It’s a good and fair review, but what struck me are the rather astonishing production values .

  • Tim Pan's 24-minute iPhone Duo review impressed viewers with high production values
  • Company subjected iPhone Duo hinge to 10,000 stress test cycles
  • Pan's Chinese employees prefer iPhone Duo over other models

More from Saturday 24 October →