Alice v0.6.0
Alice v0.6.0 November 21, 2026 in release Announcing the release of Alice v0.6.0! This change introduces several new features needed to build a small collection of packages from the Opam repository which I’ve been manually porting to Alice’s package format in alice-ports.
Alice v0.6.0 发布于 2026 年 11 月 21 日。宣布 Alice v0.6.0 正式发布!此次更新引入了多项新功能,旨在构建从 Opam 仓库中提取的一系列软件包,这些软件包此前一直由我手动移植到 alice-ports 中的 Alice 软件包格式。
New Features Access built-in modules from the standard library Alice packages may now refer to modules from the standard library which are excluded from the prelude, such as Unix and Str. A new builtins section in Alice.kdl can be used to list the built-in modules a package can access: package { name foo version “0.1.0” builtins { unix } }
新功能:访问标准库中的内置模块。Alice 软件包现在可以引用标准库中未包含在 prelude 中的模块,例如 Unix 和 Str。Alice.kdl 中新增的 builtins 部分可用于列出软件包可以访问的内置模块:package { name foo version “0.1.0” builtins { unix } }
Mixing C code with OCaml Packages may include C source files in their src directory. All C files will be compiled and linked into the resulting executable when building a project. The ability to compile C code raises the question of how to pass custom linker arguments to the C compiler, and this is addressed with another new feature: config scripts.
将 C 代码与 OCaml 混合使用。软件包可以在其 src 目录中包含 C 源文件。构建项目时,所有 C 文件都将被编译并链接到最终的可执行文件中。编译 C 代码的能力引发了如何向 C 编译器传递自定义链接器参数的问题,这一问题通过另一项新功能得到了解决:配置脚本(config scripts)。
Config Scripts A package may include a config script in a file named config.ml file in the package’s root directory (next to Alice.kdl). The config.ml file is compiled and executed as the first step of building a package, and any lines in its standard output beginning with alice: are interpreted by Alice as directives that can influence the build. Currently the only supported directives are alice:print_endline which prints a message, and alice:add_c_linker_args which adds C linker arguments.
配置脚本。软件包可以在其根目录(Alice.kdl 旁边)包含一个名为 config.ml 的文件作为配置脚本。config.ml 文件在构建软件包的第一步被编译和执行,其标准输出中任何以 alice: 开头的行都会被 Alice 解释为可以影响构建的指令。目前唯一支持的指令是 alice:print_endline(打印消息)和 alice:add_c_linker_args(添加 C 链接器参数)。
Config scripts can depend on other packages, and also access built-in modules from the standard library. This can be configured in Alice.kdl: package { name bar version “0.1.0” config_script { dependencies { foo path=”../foo” } builtins { str } } }
配置脚本可以依赖其他软件包,也可以访问标准库中的内置模块。这可以在 Alice.kdl 中进行配置:package { name bar version “0.1.0” config_script { dependencies { foo path=”../foo” } builtins { str } } }
Config scripts are expected to be run only once each time they are compiled because their output can be trivially cached in the build directory. For this reason it’s faster to compile config scripts with the bytecode compiler rather than the native compiler, and of course this means compiling all their dependencies with the bytecode compiler too.
配置脚本在每次编译时预计只运行一次,因为它们的输出可以轻松地缓存在构建目录中。因此,使用字节码编译器而不是原生编译器来编译配置脚本速度更快,当然,这也意味着需要使用字节码编译器来编译它们的所有依赖项。
Packages can be built with the bytecode compiler This was a necessary feature for allowing config scripts to be built with the bytecode compiler, but it might also be something people find useful to integrate into their workflow, since the bytecode compiler backend is generally faster than the native backend (but of course the executables it produces are generally slower to run). Commands that compile code (e.g. alice build, alice run) now take a —backend argument which can be passed native or bytecode. The default is native.
软件包可以使用字节码编译器构建。这是允许配置脚本使用字节码编译器构建的必要功能,但人们也可能发现将其集成到工作流程中很有用,因为字节码编译器后端通常比原生后端更快(当然,它生成的可执行文件运行速度通常较慢)。编译代码的命令(如 alice build, alice run)现在接受一个 —backend 参数,可以传递 native 或 bytecode。默认值为 native。
Install Alice v0.6.0 On Windows, Alice v0.6.0 can be installed with WinGet: winget install OCaml.Alice —version 0.6.0 On macOS and Linux, the latest version of Alice can be installed with Homebrew: brew install alicecaml/homebrew-tap/alice Alternatively, on macOS and Linux, Alice v0.6.0 can be installed by running the install script: curl -fsSL https://alicecaml.org/install.sh | sh -s — 0.6.0 On NixOS, Alice v0.6.0 can be installed via the flake github:alicecaml/alice#alice_0_6_0.default, e.g.: nix shell github:alicecaml/alice#alice_0_6_0.default Read more about installing Alice here.
安装 Alice v0.6.0。在 Windows 上,可以通过 WinGet 安装 Alice v0.6.0:winget install OCaml.Alice —version 0.6.0。在 macOS 和 Linux 上,可以通过 Homebrew 安装最新版本的 Alice:brew install alicecaml/homebrew-tap/alice。或者,在 macOS 和 Linux 上,可以通过运行安装脚本来安装 Alice v0.6.0:curl -fsSL https://alicecaml.org/install.sh | sh -s — 0.6.0。在 NixOS 上,可以通过 flake github:alicecaml/alice#alice_0_6_0.default 安装 Alice v0.6.0,例如:nix shell github:alicecaml/alice#alice_0_6_0.default。在此处阅读更多关于安装 Alice 的信息。
Release Notes Added Add —bin flag as an alias for —exe in arguments to alice new. Build output includes duration. Add support for config scripts. If a package has a config.ml file at its top level, Alice will build and run that file before compiling the package and parse directives from its stdout that can affect how the package is built. Currently this mechanism can be used to print messages and to add c linker args. Add “—backend” argument to for choosing the compiler backend. Alice builds with the native backend by defdault, but now supports the bytecode backend too if —backend bytecode is passed. Add a builtins field to manifests for listing the modules from the standard library to make available to the project. By default new projects will specify unix and str here. Basic support for packages including C code. All .c files in the src directory will be compiled and linked into the library or executable defined in the project.
发布说明:新增功能。在 alice new 的参数中添加 —bin 标志作为 —exe 的别名。构建输出包含持续时间。添加对配置脚本的支持。如果软件包的顶层包含 config.ml 文件,Alice 将在编译软件包之前构建并运行该文件,并从其标准输出中解析可以影响软件包构建方式的指令。目前,该机制可用于打印消息和添加 C 链接器参数。添加 “—backend” 参数以选择编译器后端。Alice 默认使用原生后端构建,但现在如果传递 —backend bytecode,也支持字节码后端。在清单中添加 builtins 字段,用于列出可供项目使用的标准库模块。默认情况下,新项目会在此处指定 unix 和 str。对包含 C 代码的软件包提供基本支持。src 目录中的所有 .c 文件都将被编译并链接到项目中定义的库或可执行文件中。