vix.ing · top · new · best · stats · spec

Polymorphic Metaprogramming with Memory Management -- An Adjoint Analysis of Metaprogramming

2024/11/01 by Junyoung Jang, Jang, Junyoung, Brigitte Pientka +1
Computer Science · #Distributed and Parallel Computing Systems #Evolutionary Algorithms and Applications #FOS: Computer and information sciences #Logic in Computer Science (cs.LO) #Parallel Computing and Optimization Techniques #Programming Languages (cs.PL)

paper · pdf · doi:10.48550/arxiv.2411.00752

openalex publication_date 2024/11/01 · openalex created_date 2024/11/14 · openalex updated_date 2026/07/28

Abstract

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.

Related