Affiliation:
1. Impredicative LLC, Cambridge, MA, USA
Abstract
Dependent types
provide a strong foundation for specifying and verifying rich properties of programs through type-checking. The earliest implementations combined dependency, which allows types to mention program variables; with type-level computation, which facilitates expressive specifications that compute with recursive functions over types. While many recent applications of dependent types omit the latter facility, we argue in this paper that it deserves more attention, even when implemented without dependency.
In particular, the ability to use functional programs as specifications enables
statically-typed metaprogramming
: programs write programs, and static type-checking guarantees that the generating process never produces invalid code. Since our focus is on generic validity properties rather than full correctness verification, it is possible to engineer type inference systems that are very effective in narrow domains. As a demonstration, we present Ur, a programming language designed to facilitate metaprogramming with first-class records and names. On top of Ur, we implement Ur/Web, a special standard library that enables the development of modern Web applications. Ad-hoc code generation is already in wide use in the popular Web application frameworks, and we show how that generation may be tamed using types, without forcing metaprogram authors to write proofs or forcing metaprogram users to write any fancy types.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
15 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Principled and practical static analysis for Python: Weakest precondition inference of hyperparameter constraints;Software: Practice and Experience;2023-11-22
2. The raise of machine learning hyperparameter constraints in Python code;Proceedings of the 31st ACM SIGSOFT International Symposium on Software Testing and Analysis;2022-07-18
3. Compositional Programming;ACM Transactions on Programming Languages and Systems;2021-09-30
4. Taming the Merge Operator;Journal of Functional Programming;2021
5. Multi-stage programming in the large with staged classes;Proceedings of the 19th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences;2020-11-16