HeadlinesBriefing favicon HeadlinesBriefing.com

Gleam v1.17.0 Adds Escript Support for BEAM Programs

Hacker News •
×

Gleam v1.17.0 introduces a streamlined way to run single-file programs on the Erlang virtual machine through its new `export escript` command. This tool compiles Gleam code into a single `.beam` file, simplifying distribution for small command-line tools. Previously, developers needed multiple `.beam` files, but now a single escript can be shared and executed anywhere Erlang is installed. This mirrors JavaScript's bundling approach but tailored for BEAM. The release also enhances Gleam's language server with documentHighlight support, allowing real-time reference tracking in editors. For instance, hovering over `vec` in code now highlights all its instances, improving developer productivity.

The update adds todo expressions in constants, enabling compile-time checks without runtime execution. This lets developers flag incomplete code in type-safe constants, preventing accidental runs. Additionally, record update hovering now shows unused fields, reducing navigation time. Previously, developers had to check definitions manually, but the language server now proactively displays missing fields. These features streamline debugging and code maintenance. The compiler also improves unknown value suggestions, automatically proposing correct module-qualified names when unrecognized symbols appear. This reduces errors caused by missing imports, a common pain point in modular programming.

Performance gains are notable in JavaScript pattern matching optimizations. The compiler now generates more efficient decision trees for case expressions, especially with bit arrays. This reduces redundant checks, speeding up runtime. The build tool also gains a `--no-print-progress` flag, quieting output during development. While Gleam's `deps outdated` command previously listed updates, it now summarizes package counts, showing how many dependencies need attention. For example, a project might find "1 of 12 packages have newer versions," prompting targeted updates. These changes make Gleam more practical for real-world use, balancing type safety with developer workflow efficiency. The language's focus on BEAM and JavaScript runtimes positions it as a versatile tool for both Erlang and web developers.