首页›Gleam News›文章

Formalising external APIs

Louis Pilfold · 2025年10月19日

AI 摘要 AI 生成,可能有误

Gleam v1.13.0 已发布,引入了正式化的外部 API,使 JavaScript 代码能够安全地构建和操作 Gleam 数据类型,同时还新增了一份关于如何在不依赖编译器内部 API 的情况下正确编写外部函数的指南。该版本还带来了多项编译器改进,包括可大幅缩短位数组模式匹配编译时间的基于干扰的剪枝技术、针对不可达位数组模式和未使用的递归函数参数的新警告,以及对语言服务器容错分析功能的扩展。其他改进包括:为私有不透明类型提供了更好的错误消息和快速修复操作,弃用了冗余的 `_ as x` 模式别名,针对 `list.length` 的低效用法新增了警告,并为误在函数内部使用 `const` 的 JavaScript 开发者提供了有帮助的语法错误提示。

Gleam is a type-safe and scalable language for the Erlang virtual machine and JavaScript runtimes. Today Gleam v1.13.0 has been published. Let's go over all the highlights now.

External API for Gleam data

One of Gleam's strengths is that it is part of the BEAM and JavaScript ecosystems, enabling Gleam programs to take advantage of code written in Erlang, Elixir, JavaScript, and more. This is a large part of how Gleam was able to become a practical production-ready language so quickly, by not restricting Gleam programmers to just the comparatively young Gleam package ecosystem.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Gleam News

Gleam doesn't compile to Erlang source anymore

AI 摘要Gleam v1.19.0 features a rewritten Erlang code generator that now compiles to Erlang abstract forms instead of Erlang source code, significantly improving build times and making runtime metadata such as stack trace line numbers accurately reference the original Gleam source. The release also brings JavaScript compilation improvements (flatter decision trees and faster short list literals), TypeScript API overloads that preserve type information, and better support for external build tools like Elixir's Mix and Erlang's rebar3. Additional updates include language server support for labels (go-to-definition, references, renaming) and the ability to format Gleam code in the browser via the WebAssembly compiler build.

Gleam Gathering 2027 is coming to London!

AI 摘要Gleam Gathering 2027 is coming to London, with tickets already available and the call for talks now open. The article celebrates the success of the first-ever 100% Gleam conference in Bristol earlier this year, whose 2026 talks have all been released online. Community members are encouraged to submit talk proposals if they have interesting Gleam projects, learnings, libraries, tools, or topics worth sharing.

Help from the Github Security Lab

AI 摘要The Gleam project participated in the 4th GitHub Secure Open Source Fund, which provided a 3-week security training program, a 12-month engagement, and $10,000 in sponsorship, and it turned out the project was already in an excellent security position with no vulnerabilities uncovered. Key takeaways include the value of expert guidance in converting security unknowns into knowns, the importance of evidencing security through policies, documentation, and compliance frameworks rather than just being technically secure, and the striking cost-effectiveness of investing in open source security across the fund's 50 projects.

A field day for Gleam’s language server

AI 摘要Gleam v1.18.0 has been released, bringing major language server improvements such as go-to-definition, find-references, and rename support for record fields, type variable and module renaming with automatic import updates, plus new code actions for pattern matching on values, converting integer bases, generating missing types, and converting comments. The release also delivers performance gains through data singletons that speed up generated JavaScript and compiler memory arenas that make the formatter up to 13% faster, alongside deprecation of ambiguous pipe syntax, git dependency path support, and various Hex package manager improvements.

Single file Gleam BEAM programs with escript

AI 摘要Gleam v1.17.0 has been released, introducing the `gleam export escript` command for bundling BEAM projects into single executable files, alongside JavaScript pattern matching optimisations and various language server improvements such as document highlighting, context-aware type printing, and new code actions. The release also includes build tool enhancements like a quiet development mode, an outdated dependencies summary in `gleam deps outdated`, better Git repository detection for monorepos, and support for `todo` in constant expressions. Additionally, the first videos from the all-Gleam Gleam Gathering conference have been published on YouTube.