跳到正文
EasyXiv 检索
投稿 关于 登录

按回车检索 · 直接输入编号(如 1706.03762)可跳转到论文

计算机科学 > 程序设计语言

arXiv:2511.10343 (cs)
[提交于 2025年11月13日 (v1),最后修订于 2026年11月23日 (此版本, v3)]

标题:Omnidirectional type inference for ML: principality any way

作者:Alistair O'Brien, Didier Rémy, Gabriel Scherer
查看论文《Omnidirectional type inference for ML: principality any way》的 PDF
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读
摘要:The Damas-Hindley-Milner (ML) type system owes its success to principality, the property that every well-typed expression has a unique most general type. This makes inference predictable and efficient. Unfortunately, many extensions of ML (GADTs, higher-rank polymorphism, and static overloading) endanger princpality by introducing _fragile_ constructs that resist principal inference. Existing approaches recover principality through directional inference algorithms, which propagate _known_ type information in a fixed (or static) order (e.g. as in bidirectional typing) to disambiguate such constructs. However, the rigidity of a static inference order often causes otherwise well-typed programs to be rejected. We propose _omnidirectional_ type inference, where type information flows in a dynamic order. Typing constraints may be solved in any order, suspending when progress requires known type information and resuming once it becomes available, using _suspended match constraints_. This approach is straightforward for simply typed systems, but extending it to ML is challenging due to let-generalization. Existing ML inference algorithms type let-bindings (let x = e1 in e2) in a fixed order: type e1, generalize its type, and then type e2. To overcome this, we introduce _incremental instantiation_, allowing partially solved type schemes containing suspended constraints to be instantiated, with a mechanism to incrementally update instances as the scheme is refined. Omnidirectionality provides a general framework for restoring principality in the presence of fragile features. We demonstrate its versatility on two fundamentally different features of OCaml: static overloading of record labels and datatype constructors and semi-explicit first-class polymorphism. In both cases, we obtain a principal type inference algorithm that is more expressive than OCaml's current typechecker.
评论: updated to reflect the final TOPLAS version; 46 pages + appendices
主题: 程序设计语言 (cs.PL)
引用方式: arXiv:2511.10343 [cs.PL]
  (或者 arXiv:2511.10343v3 [cs.PL] 对于此版本)
  https://doi.org/10.48550/arXiv.2511.10343
相关 DOI: https://doi.org/10.1145/3848026

提交历史

来自:Gabriel Scherer
[v1] 2025年11月13日 星期四 14:15:36 UTC (181 KB)
[v2] 2026年5月1日 星期五 10:33:38 UTC (190 KB)
[v3] 2026年11月23日 星期一 20:32:51 UTC (194 KB)
全文链接:

访问论文:

  • 查看原文 PDF
  • 中文 PDF (下批处理)
  • EasyResearch 阅读
  • TeX 源文件
  • arXiv 原文页面
查看许可

当前浏览上下文:

cs.PL
< 上一篇   |   下一篇 >
最新 | 近期 | 2026-11
切换浏览方式为:
cs

参考文献与引用

  • Google Scholar
  • Semantic Scholar

BibTeX 格式的引用

EasyXiv 是独立运营的中文预印本站点,与 arXiv 及康奈尔大学无隶属关系。 论文元数据与原文来自 arXiv.org,感谢 arXiv 提供开放获取服务。
关于 · 帮助 · 投稿指南 · 版权 · arXiv 原站