Multi-stage programming in the large with staged classes

Lionel Parreaux, Amir Shaikhha

Research output: Chapter in Book/Report/Conference proceedingConference contribution

Abstract / Description of output

Multi-stage programming (MSP) holds great promise, allowing the reliable generation of specialized, partially-evaluated code with static type- A nd scope-safety guarantees. Yet, we argue that MSP has not reached its full potential yet, as it has been traditionally limited to generating expressions, and has lacked principled facilities for generating modular programs and data structures. In that sense, we argue that MSP has been reserved for programming "in the small,"focused on generating efficient kernels of computation on the scale of single function bodies. We present a novel technique called staged classes, which extends MSP with the ability to manipulate class definitions as first-class constructs. This lets programmers use MSP "in the large,"on the level of applications, rather than mere functions. This way, applications can be designed in an abstract and modular way without runtime cost, as staged classes guarantee the removal of all staging-time abstractions, resulting in the generation of efficient specialized modules and data structures. We describe the design of a prototype relational database system in Scala, which uses several stages of runtime compilation to maximize the efficiency of query execution and data storage. We also show that staged classes can be used for defining type- A nd scope-safe implementations of type providers.
Original languageEnglish
Title of host publicationGPCE 2020 - Proceedings of the 19th ACM SIGPLAN International Conference on Generative Programming
Subtitle of host publicationConcepts and Experiences
EditorsMartin Erwig, Jeff Gray
PublisherACM
Pages35-49
Number of pages15
ISBN (Electronic)9781450381741
DOIs
Publication statusPublished - 16 Nov 2020
Event19th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences - Virtual, Online
Duration: 16 Nov 202017 Nov 2020

Publication series

NameProceedings of the International ACM SIGPLAN Conference on Generative Programming & Component Engineering
PublisherACM
ISSN (Electronic)2380-9442

Conference

Conference19th ACM SIGPLAN International Conference on Generative Programming
Abbreviated titleGPCE 2020
CityVirtual, Online
Period16/11/2017/11/20

Keywords / Materials (for Non-textual outputs)

  • multi-stage programming
  • squid
  • staged classes

Fingerprint

Dive into the research topics of 'Multi-stage programming in the large with staged classes'. Together they form a unique fingerprint.

Cite this