hn.today

Gleam doesn't compile to Erlang source anymore

gleam.run315 points136 comments
Screenshot of Gleam doesn't compile to Erlang source anymore

Gleam v1.19.0 changes the Erlang backend from emitting Erlang source to emitting Erlang abstract forms - the parser-produced intermediate representation encoded in the Erlang external term format. Emitting abstract forms lets Gleam skip the front-end of the Erlang compiler, improving compile performance and making runtime location metadata map precisely to original Gleam source (so BEAM crash reports and stack traces show correct Gleam line numbers). Benchmarks using a 100-module/100-function test show a marked speedup versus v1.17.0, and the team explains why generating BEAM bytecode directly was rejected: bytecode evolves, requires constant maintenance and reimplementing decades of Erlang optimisations, and is not cost-effective for a community-funded project. The approach follows Elixir’s precedent and raises compiler code-quality by replacing an old generator with a cleaner design.

The release also ships several practical JVM/JS and tooling improvements. JavaScript compilation flattens pattern-match decision trees into single-condition checks, reducing branches and intermediate variables; short Gleam list literals now compile to direct prepend chains instead of building arrays and converting them, improving runtime for many cases. TypeScript declaration generation gains overloads to preserve type information for variant-checking helpers. Build-tool integration improvements include automatic .app file generation, a compile-package --no-dev flag, and export commands that can write to stdout or files, easing use from Mix/rebar3. Key contributors named include Giacomo Cavalieri, John Downey and Rodrigo Álvarez.

Read on gleam.run136 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

Laravel Rust

Laravel Rust

Laravel for Rust is a full-stack web framework with routing, validation, database tools, background jobs, and real-time features. It also supports Inertia for frontend integration and is released under the MIT license. (github.com)

The Uberization of Software

The Uberization of Software

Ride-hailing apps greatly expanded demand for trips but undercut the value of taxi medallions and squeezed driver earnings by removing the supply limits that had protected them. The essay argues that software engineering faces a similar paradox: rising demand can lower workers’ pay when technology rapidly expands the supply of labor. (lsrx.net)

The daily digest

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