paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Fulfilling OCaml Modules with Transparency

以透明性完善 OCaml 模块
OOPSLA 8(OOPSLA1)2024匹配度 2/10 · 论文是纯 PL 类型系统与形式语义工作,聚焦 OCaml 模块系统的透明归属与可靠性证明,未涉及 LLM/Agent、静态分析工具、浮点程序分析或贝叶斯程序分析,与用户画像中 PL 与 AI 交叉的核心方向基本无关。引用 2 inbox
Blaudeau Clement, Didier Rémy, Gabriel Radanne
crossref: 2026-09-10

AI 速览

一句话:提出 Mω 类型系统,覆盖 OCaml 模块中的 applicative/generative functor 与透明归属,并经 Fω 精化证明其可靠性。

ML 模块提供组合与抽象,但高级用法复杂,OCaml 模块层缺乏形式规范且实现有意外行为。本文在 ML 模块到 Fω 翻译基础上提出类型系统 Mω,覆盖 OCaml 模块较大子集,含 applicative/generative functor 与透明归属。Mω 生成带 Fω 量词的类 OCaml 签名,并给出到基于路径源签名的逆向翻译及签名规避刻画,适合作类型检查器内部表示。作者经 Fω 精化证明可靠性,引入透明存在类型(可从全称与箭头类型提升的弱存在类型),改进 applicative functor 中 sealing 编码,使 applicative 抽象处理更接近 generative functor。

问题
OCaml 等 ML 模块系统的高级用法复杂,且 OCaml 模块层缺乏形式规范,实现存在意外行为;现有对 ML 模块到 Fω 的编码在 applicative functor 的 sealing 与透明归属方面仍不完善。
方法
提出类型系统 Mω,覆盖 OCaml 模块较大子集(applicative 与 generative functor),扩展透明归属,生成带 Fω 量词的类 OCaml 签名,并给出到基于路径源签名的逆向翻译与签名规避刻画;通过到 Fω 的精化证明可靠性,引入透明存在类型。
评估
以 Fω 精化作为可靠性证明,并展示 Mω 签名可作类型检查器内部表示;通过透明存在类型改进 applicative functor 中 sealing 的编码,说明其抽象处理更接近 generative functor。
原文摘要(Abstract)

ML modules come as an additional layer on top of a core language to offer large-scale notions of composition and abstraction. They largely contributed to the success of OCaml and SML. While modules are easy to write for common cases, their advanced use may become tricky. Additionally, despite a long line of works, their meta-theory remains difficult to comprehend, with involved soundness proofs. In fact, the module layer of OCaml does not currently have a formal specification and its implementation has some surprising behaviors. Building on previous translations from ML modules to Fω, we propose a type system, called Mω, that covers a large subset of OCaml modules, including both applicative and generative functors, and extended with transparent ascription. This system produces signatures in an OCaml-like syntax extended with Fω quantifiers. We provide a reverse translation from Mω signatures to path-based source signatures along with a characterization of signature avoidance cases, making Mω signatures well suited to serve as a new internal representation for a typechecker. The soundness of the type system is shown by elaboration in Fω. We improve over previous encodings of sealing within applicative functors, by the introduction of transparent existential types, a weaker form of existential types that can be lifted out of universal and arrow types. This shines a new light on the form of abstraction provided by applicative functors and brings their treatment much closer to those of generative functors.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot2535,
  title = {Fulfilling OCaml Modules with Transparency},
  author = {Blaudeau Clement and Didier Rémy and Gabriel Radanne},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {OOPSLA1},
  year = {2024},
  doi = {10.1145/3649818}
}