hn.today

Substrate: A Lisp for WebAssembly

substrate-lang.com3 points0 comments
Screenshot of Substrate: A Lisp for WebAssembly

Substrate is a Lisp-like language designed specifically for WebAssembly, combining C-style control over memory and low-level operations with Racket-style hygienic macros. Its central idea is to make languages and domain-specific tools easy to build as importable libraries: examples include a dependently typed language with proofs, a Scheme-like language using reference counting rather than tracing garbage collection, and a web UI framework. The compiler is self-hosted, runs in the browser, and is presented as compact and fast. The project reports compilation at about 46,500 lines per second and runtime around 1.43 times that of C compiled to Wasm with optimization.

Programs run in a sandbox by default, with filesystem and network access requiring explicit permission; the compiler and build system are sandboxed as well. Demonstrations include browser games, a WebAssembly build of SQLite with a Substrate API, and an interactive playground that compiles and runs code in a browser worker. Substrate is positioned for projects needing portable, fast Wasm tooling or extensive compile-time metaprogramming, rather than as a general replacement for C, Rust, or Zig. It is still evolving: APIs may change before version 1.0, and while the small compiler core is extensively tested and used by its developers, other language components and libraries are less battle-tested. The broader ambition is to provide a flexible platform for experimenting with both high-level verification and low-level programming in a more Wasm-centered future.

Read on substrate-lang.com0 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.