Skip to main content
QUICK REVIEW

[논문 리뷰] Taming Scope Extrusion in Gradual Imperative Metaprogramming

Tianyu Chen, Darshal Shetty|arXiv (Cornell University)|2026. 02. 23.
Logic, programming, and type systems인용 수 0
한 줄 요약

논문은 가변 참조를 지원하고 환경 분류기를 동적으로 강제하여 범위 안전을 보장하는 점진적 메타프로그래밍 언어, lambda^{alpha,*}_{Ref}를 제시하며, 환경 분류기 서브타이핑이 자유로운 정적 형식 대응 lambda^{alpha}_{Ref}를 함께 제시한다.

ABSTRACT

Metaprogramming enables the generation of performant code, while gradual typing facilitates the smooth migration from untyped scripts to robust statically typed programs. However, combining these features with imperative state - specifically mutable references - reintroduces the classic peril of scope extrusion, where code fragments containing free variables escape their defining lexical context. While static type systems utilizing environment classifiers have successfully tamed this interaction, enforcing these invariants in a gradual language remains an open challenge. This paper presents $λ^{α,\star}_{ ext{Ref}}$, the first gradual metaprogramming language that supports mutable references while guaranteeing scope safety. To put $λ^{α,\star}_{ ext{Ref}}$ on a firm foundation, we also develop its statically typed sister language, $λ^α_{ ext{Ref}}$, that introduces unrestricted subtyping for environment classifiers. Our key innovation, however, is the dynamic enforcement of the environment classifier discipline in $λ^{α,\star}_{ ext{Ref}}$, enabling the language to mediate between statically verified scopes and dynamically verified scopes. The dynamic enforcement is carried out in a novel cast calculus $\mathrm{CC}^{α,\star}_{ ext{Ref}}$ that uses an extension of Henglein's Coercion Calculus to handle code types, classifier polymorphism, and subtype constraints. We prove that $λ^{α,\star}_{ ext{Ref}}$ satisfies type safety and scope safety. Finally, we provide a space-efficient implementation strategy for the dynamic scope checks, ensuring that the runtime overhead remains practical.

연구 동기 및 목표

  • 점진적 impérative 메타프로그래밍에서 가변 상태와 함께 범위 extrusion 문제를 동기로 삼아 다룬다.
  • 가변 참조를 지원하면서 범위 안전을 보장하는 점진적 메타프로그래밍 언어를 개발한다.
  • 런타임에 환경 분류기 규율을 동적으로 강제하는 캐스트 계산을 형성한다.
  • 접근 방식을 뒷받침하기 위해 환경 분류기의 서브타이핑이 제한 없이 가능한 정적 자매 언어를 제공한다.

제안 방법

  • lambda^{alpha,*}_{Ref}, 가변 참조를 갖는 점진적 메타프로그래밍 언어를 도입한다.
  • lambda^{alpha}_{Ref}, 서브타이핑이 제한 없이 가능한 환경 분류기 서브타이핑을 갖는 정적 언어를 개발한다.
  • Henglin의 Coercion Calculus를 코드 타입, 분류자 다형성, 서브타입 제약에 대한 동적 캐스트 계산 CC^{alpha,*}_{Ref}로 확장한다.
  • 점진적 언어의 형식 안전성과 범위 안전성을 입증한다.
  • 동적 범위 검사에 대한 공간 효율적 구현 전략을 설명한다.

실험 결과

연구 질문

  • RQ1가변 참조를 갖는 점진적 메타프로그래밍을 어떻게 범위 안전하게 만들 수 있는가?
  • RQ2안전성을 유지하는 데 있어 동적 환경 분류기 강제의 역할은 무엇인가?
  • RQ3제한 없이 환경 분류기 서브타이핑을 허용하는 정적 대응이 동일한 보장을 지원할 수 있는가?
  • RQ4동적 범위 검사 오버헤드는 얼마나 되며 이를 공간 효율적으로 만들 수 있는가?

주요 결과

  • 가변 참조를 갖는 점진적 메타프로그래밍 언어가 범위 안전을 달성하도록 제안되고 형식화되었다.
  • 환경 분류기 서브타이핑이 제한 없이 가능한 정적 자매 언어가 도입되었다.
  • 런타임에 환경 분류기 규율을 강제하기 위한 동적 캐스트 계산 CC^{alpha,*}_{Ref}가 개발되었다.
  • 점진적 언어의 형식 안전성과 범위 안전성에 대한 형식적 증명이 확립되었다.
  • 동적 범위 검사를 현실적으로 유지하기 위한 공간 효율적 런타임 접근 방식이 제시되었다.

더 나은 연구,지금 바로 시작하세요

연구 설계부터 논문 작성까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.