paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Refined² Environment Classifiers

Refined² 环境分类器
OOPSLA 10(OOPSLA2)2026匹配度 1/10 · 该论文研究 MetaML 式多阶段编程的类型系统与作用域逃逸静态排除,属于纯 PL/形式化验证方向,不涉及 LLM/Agent、机器学习系统静态分析、浮点程序分析或贝叶斯程序分析,与用户当前研究画像的核心问题几乎没有交集。引用 0 inbox
Yuito Murase, Atsushi Igarashi
crossref: 2026-10-02

AI 速览

一句话:为支持可变状态的 MetaML 式多阶段编程提出 Refined² 环境分类器类型系统,静态排除有害作用域逃逸。

MetaML 风格多阶段编程支持准引用代码生成、运行时执行和跨阶段持久化,但与可变状态等效应交互微妙:生成代码可能发生作用域逃逸,逃出其依赖变量的作用域。本文为带可变状态的 MetaML 式多阶段编程提出类型系统,静态排除有害作用域逃逸,并支持多级代码生成、运行时执行及一种 CSP 变体。系统基于 refined environment classifiers(RECs),以变量作用域标注代码类型;作者进一步精化分类器,使其同时追踪变量作用域与分类器自身作用域,并引入分类器多态以支持更通用的多级生成模式。论文通过定义性解释器定义操作语义,证明类型可靠性与离线代码生成安全性,表明生成代码可抽取为独立良类型程序,并给出实现和 Rocq 机器化证明。

问题
带可变状态的 MetaML 式多阶段编程中,可变状态可能导致作用域逃逸,使生成代码逃出其所依赖变量的作用域;如何静态排除这种有害逃逸是核心问题。
方法
提出基于 refined environment classifiers 的类型系统,进一步精化分类器以同时追踪变量作用域与分类器自身作用域,并引入分类器多态;用定义性解释器给出操作语义。
评估
证明类型可靠性与离线代码生成安全性,表明生成代码可抽取为独立良类型程序,并提供可运行实现与 Rocq 机器化证明。
原文摘要(Abstract)

MetaML-style multi-stage programming (MSP) supports quasi-quotation-based code generation, runtime execution of generated code, and cross-stage persistence (CSP). However, its interaction with computational effects is subtle: mutable state can cause scope extrusion, where generated code escapes the scope of variables on which it depends. This paper presents a type system for MetaML-style MSP with mutable state that statically rules out harmful scope extrusion while supporting multi-level code generation, runtime execution, and a variant of CSP. Our system builds on refined environment classifiers (RECs), a discipline that annotates code types with the variable scopes on which generated code depends. To scale RECs to the MetaML-style setting, we refine classifiers so that they track not only variable scopes, but also the scopes of classifiers themselves. Further, we integrated polymorphism over classifiers, enabling more general and reusable code generation patterns in a multi-level setting. For the resulting system, we define an operational semantics via a definitional interpreter and prove type soundness and safety of offline code generation, showing that generated code can be extracted as standalone well-typed programs. We provide working implementations and mechanized proofs in Rocq.

链接与引用

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

BibTeX
@article{paperbot12164,
  title = {Refined² Environment Classifiers},
  author = {Yuito Murase and Atsushi Igarashi},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {10},
  number = {OOPSLA2},
  year = {2026},
  doi = {10.1145/3839493}
}