带内存管理的多态元编程——元编程的伴随分析
Polymorphic Metaprogramming with Memory Management -- An Adjoint Analysis of Metaprogramming
AI总结:
该研究提出基于伴随模态的多态元编程框架Elevator,通过模式预序区分内存区域并控制访问,拓展元编程逻辑视角,还证明了语言的子结构性、类型安全与模式安全。
摘要:
我们提出了Elevator,这是一种基于伴随模态(adjoint modalities)的统一多态基础,用于支持带内存管理的元编程。在该框架下,我们通过模式(mode)区分多个内存区域,每个模式都具备一组特定的结构性质。这不仅让我们能够刻画线性(即无垃圾回收的)内存区域和(普通的)直觉主义(即带垃圾回收或持久化的)内存区域,还能通过模式之间的预序关系刻画内存区域间的可访问性。这种预序关系赋予我们描述单子(monadic)和余单子(comonadic)编程的能力。由此,它从两个方向拓展了现有的元编程逻辑视角:第一,通过控制内存访问确保代码生成可高效执行;第二,我们能够为生成的代码提供资源保证(例如生成无垃圾回收的代码)。我们给出了Elevator的静态语义与动态语义,特别证明了变量引用的子结构性以及该语言的类型安全性。我们还建立了模式安全性,可保证项的求值不会访问不可访问内存中的值。
英文摘要:
We describe Elevator, a unifying polymorphic foundation for metaprogramming with memory management based on adjoint modalities. In this setting, we distinguish between multiple memory regions using modes where each mode has a specific set of structural properties. This allows us not only to capture linear (i.e. garbage-free) memory regions and (ordinary) intuitionistic (i.e. garbage-collected or persistent) memory regions, but also to capture accessibility between the memory regions using a preorder between modes. This preorder gives us the power to describe monadic and comonadic programming. As a consequence, it extends the existing logical view of metaprogramming in two directions: first, it ensures that code generation can be done efficiently by controlling memory accesses; second, it allows us to provide resource guarantees about the generated code (i.e. code that is for example garbage-free). We present the static and dynamic semantics of Elevator. In particular, we prove the substructurality of variable references and type safety of the language. We also establish mode safety, which guarantees that the evaluation of a term does not access a value in an inaccessible memory.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。