Urgent.News

What's breaking now, across thousands of outlets.

Editions

Tech

Opus is a minimal, statically-scoped Lisp dialect based on the semantics of f-expressions (the Kernel language)

Opus is a concise, statically-scoped Lisp dialect derived from f-expressions, originally designed based on the Kernel language principles. Implemented in Haskell, Opus employs Continuation-Passing Style (CPS) for control flow and compiles to WebAssembly. Its primary design objective is to reduce the language's trusted computing base (Special Forms) while enhancing expressive power through orthogonal abstraction.

Unlike conventional Lisps that differentiate functions and macros, Opus integrates them into a single primitive: the operative ($vau). Environments are treated as first-class executable values within Opus. The usual eval function is conceptually replaced by applying an environment to an Abstract Syntax Tree (AST), shifting language feature responsibilities from compiler/interpreter implementation to user-land code.

The core of Opus is the operative ($vau), which differs from traditional functions by accepting unevaluated arguments and providing explicit access to the calling environment. This characteristic allows deriving standard Lisp features from first principles. For instance, a $lambda in Opus is essentially a wrapped operative that evaluates its arguments before execution.

Opus naturally fosters several complex features due to its minimal ruleset. By treating environments as operatives that evaluate ASTs within their scope, it enables the creation of a hygienic module export system entirely in user-space. The prelude.op file exemplifies this, demonstrating that Opus can support mathematically safe, read-only sandboxes by redefining or removing binding capabilities within child environments.

Furthermore, Opus, implemented with a CPS-based interpreter (ContT), inherently supports Proper Tail calls and First-class Continuations. For example, capturing and invoking a continuation in the REPL showcases these capabilities. To use Opus, ensure the wasm32-wasi-ghc toolchain is configured.

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

Read the original at github.com →

More in Tech

Going freestanding

  • Go language can be compiled to C code, creating Solod subset.
  • Solod aims to provide Go-like experience with freestanding code.
  • Author ported Go's standard library to make packages freestanding.

Money as a data type

Most guides open with 0.1 + 0.2 === 0.30000000000000004 and conclude "don't use floats for money." True, and not very useful.

  • Money is a combination of number, currency, scale, and rounding policy
  • Floats for money can lose precision and cause unexpected results
  • Storing minor units as integer values in BigInt ensures exactness

More from Thursday 20 August →