Handling Scope Checks: A Comparative Framework for Dynamic Scope Extrusion Checks
摘要
Metaprogramming and effect handlers interact in unexpected, and sometimes undesirable, ways. One example is scope extrusion: the generation of ill-scoped code. Scope extrusion can either be preemptively prevented, via static type systems, or retroactively detected, via dynamic checks. Static type systems exist in theory, but struggle with a range of implementation and usability problems in practice. In contrast, dynamic checks exist in practice (e.g. in MetaOCaml), but are understudied in theory. Designers of metaprogramming languages are thus given little guidance regarding the design and implementation of checks. We present the first formal study of dynamic scope extrusion checks, introducing a calculus (𝜆 ⟨ ⟨op⟩ ⟩ ) for describing and evaluating checks. Further, we introduce a novel dynamic check -the "Cause-for-Concern" check -which we prove correct, characterise without reference to its implementation, and argue combines the advantages of existing dynamic checks. Finally, we extend our framework with refined environment classifiers, which statically prevent scope extrusion, and compare their expressivity with the dynamic checks.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 2 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Handling the Selection Monad 引用了 Retrofitting effect handlers onto OCaml
- Mechanised Semantics of Multi-stage Programming 引用了 Staging with class: a specification for typed template Haskell
- Retrofitting effect handlers onto OCaml 引用了 Compiler and runtime support for continuation marks
- Refined² Environment Classifiers 引用了 Mechanised Semantics of Multi-stage Programming
引用它的顶会 Paper2
它引用的 Paper5
- Retrofitting effect handlers onto OCamlK. C. Sivaramakrishnan, Stephen Dolan, Leo White, Tom Kelly 等PLDI 2021 · 56 次引用
- Staging with class: a specification for typed template HaskellNingning Xie, Matthew Pickering, Andres Löh, Nicolas Wu 等POPL 2022 · 17 次引用
- flap: A Deterministic Parser with Fused LexingJeremy Yallop, Ningning Xie, Neel KrishnaswamiPLDI 2023 · 10 次引用
- Compiler and runtime support for continuation marksMatthew Flatt, R. Kent DybvigPLDI 2020 · 9 次引用
- Handling the Selection MonadGordon D. Plotkin, Ningning XiePLDI 2025 · 1 次引用
相关 Paper
- A typed continuation-passing translation for lexical effect handlersPhilipp Schuster, Jonathan Immanuel Brachthäuser, Marius Müller, Klaus OstermannPLDI 2022 · 10 次引用
- Dynamic Wind for Effect HandlersDavid Voigt, Philipp Schuster, Jonathan Immanuel BrachthäuserOOPSLA 2025
- From Capabilities to Regions: Enabling Efficient Compilation of Lexical Effect HandlersMarius Müller, Philipp Schuster, Jonathan Lindegaard Starup, Klaus Ostermann 等OOPSLA 2023 · 7 次引用
- Modal Effect TypesWenhao Tang, Leo White, Stephen Dolan, Daniel Hillerström 等OOPSLA 2025 · 4 次引用
- When Do Staging Annotations Preserve Semantics? Mechanizing Typed Semantics-Preserving Multi-stage Programming with Let-InsertionJun Tan, Guannan WeiOOPSLA 2026
