Handling Scope Checks (Extended Version)
Michael Lee, Ningning Xie, Oleg Kiselyov, Jeremy Yallop

TL;DR
This paper provides a formal framework for understanding and evaluating dynamic scope extrusion checks in metaprogramming, introducing a novel check and comparing static and dynamic approaches.
Contribution
It introduces the first formal calculus for dynamic scope extrusion checks, including a new 'Cause-for-Concern' check, and compares static and dynamic methods using refined environment classifiers.
Findings
The 'Cause-for-Concern' check is proven correct.
Dynamic checks can be effectively characterized and evaluated.
Static environment classifiers can prevent scope extrusion statically.
Abstract
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 metalanguages 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 () for describing and evaluating checks. Further, we introduce a novel dynamic check the "Cause-for-Concern" check…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Software Engineering Research · Software Testing and Debugging Techniques
