Paul Krill
Editor at Large

Gleam update shines on external types

news
Jan 15, 20262 mins

Type-safe language for the Erlang VM and JavaScript runtimes now supports external annotations for external types.

Light, sun, shining. Abstract reflections of light.
Credit: irina02/Shutterstock

Gleam 1.14.0, a new version of the statically typed language for the Erlang VM and JavaScript runtimes, has enhanced support for external types.

Released December 25, the update can be accessed at GitHub. With this release, the @external annotation is now supported for external types, giving the programmer a way to specify an Erlang or TypeScript type definition to be used, according to Gleam creator Louis Pilfold. Gleam’s external type feature is used to declare an Erlang or JavaScript type that can be referenced in Gleam, but because the type originates from outside of Gleam, the Gleam compiler cannot produce a precise definition in generated Erlang or TypeScript type definitions. Instead, the compiler had to fall back to the correct but vague “any” type of each language.

Also enhanced in Gleam 1.14.0 is inference-based pruning, an optimization that improves performance and detects more redundant patterns when pattern matching on binary data. Gleam 1.14.0 extends this optimization to work with int segments, thus increasing its effectiveness.

Gleam 1.14.0 also offers number normalization in pattern matching analysis, resulting in faster code. Numbers can be written in different formats in Gleam (decimal, octal, hexidecimal, etc., or scientific notation could be used to represent floats). The compiler now internally normalizes these values to a single canonical representation. This representation now is used by the pattern matching analysis engine, further enabling optimizations such as interference-based pruning.

Other improvements in Gleam 1.14.0:

  • Equality testing has been made faster. Performance of == and !=has been improved for field-less custom type variants when compiling to JavaScript.
  • The record update syntax now can be used in constant definitions, enabling constant records to be constructed from other constant records.
  • The release updates to the latest Elixir compiler API, fixing some warnings that would be emitted with previous versions of Gleam and the latest version of Elixir.
Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author