Title
Module generation without regret
Abstract
Modules are an indispensable mechanism for providing abstraction to programming languages. To reduce the abstraction overhead in the usage of modules, Watanabe et al. proposed a language for generating and manipulating code of modules, and implemented it via a translation to plain MetaOCaml. Unfortunately, their solution has a serious problem of code explosion if functors are repeatedly applied to modules. Another problem in their solution is that it does not allow nested modules. This paper proposes a refined translation for a two-stage typed language with module generation where nested modules are allowed. Our translation does not suffer from the code-duplication problem. The key idea is to use the genlet operator in latest MetaOCaml, which performs let insertion at the code-generation time to allow sharing of code fragments. To our knowledge, our work is the first to apply genlet to code generation for modules. We conduct an experiment using a microbenchmark, and the result shows that our method is effective to reduce the size of generated code that would have been exponentially large.
Year
DOI
Venue
2020
10.1145/3372884.3373160
Proceedings of the 2020 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation
Keywords
DocType
ISBN
Modules, Program Generation, Program Transformation, Type Safety
Conference
978-1-4503-7096-7
Citations 
PageRank 
References 
0
0.34
0
Authors
3
Name
Order
Citations
PageRank
Yuhi Sato100.68
Yukiyoshi Kameyama217117.29
Takahisa Watanabe300.68