Fluid Quotes: Metaprogramming across Abstraction Boundaries with Dependent Types
Mon 16 Nov 2020 05:40 - 06:00 at SPLASH-III - Chair(s): Friedrich Steimann
Object-oriented programming, functional programming, and metaprogramming each offer a unique axis of abstraction that enables modular code. Macros, a common technique for metaprogramming, capture ASTs as quotes to let users manipulate them in the host language. However, macros are often at odds with other programming techniques since they can only process code written at the call-site and cannot analyze code behind abstraction boundaries such as variables and methods. Furthermore, the quotes generated for macro expansion exist only at compile-time and cannot be passed around in user code. Multi-stage programming treats quotes as runtime values to address this problem, but introduces the cost of running the compiler when splicing quotes. This forces developers to choose between low runtime overhead and modularity. What if we could have the best of both worlds? We introduce fluid quotes, a new technique that uses dependent types to let users pass quotes through abstraction boundaries in runtime code while splicing them ahead-of-time. This technique enables new metaprogramming capabilities by eliminating the traditional requirement of co-locating parameter expressions with call-sites. Fluid quotes capture not only source code but also associated runtime context to ensure correctness. In addition, they can be composed into larger expressions without any macro code. We demonstrate the capabilities of fluid quotes through two specific applications: optimizing data processing pipelines and making language integrated queries more flexible.
Sun 15 NovDisplayed time zone: Central Time (US & Canada) change
17:00 - 18:20 | |||
17:00 20mTalk | VarSem: Declarative Expression and Automated Inference of Variable Usage Semantics GPCE Link to publication DOI Media Attached | ||
17:20 20mTalk | Monadification of Attribute Grammars SLE Link to publication DOI Pre-print Media Attached | ||
17:40 20mTalk | Fluid Quotes: Metaprogramming across Abstraction Boundaries with Dependent Types GPCE Shadaj Laddad University of California at Berkeley, Koushik Sen University of California at Berkeley Link to publication DOI Pre-print Media Attached | ||
18:00 20mTalk | Strategic Tree Rewriting in Attribute Grammars SLE Link to publication DOI Pre-print Media Attached |
Mon 16 NovDisplayed time zone: Central Time (US & Canada) change
05:00 - 06:20 | |||
05:00 20mTalk | VarSem: Declarative Expression and Automated Inference of Variable Usage Semantics GPCE Link to publication DOI Media Attached | ||
05:20 20mTalk | Monadification of Attribute Grammars SLE Link to publication DOI Pre-print Media Attached | ||
05:40 20mTalk | Fluid Quotes: Metaprogramming across Abstraction Boundaries with Dependent Types GPCE Shadaj Laddad University of California at Berkeley, Koushik Sen University of California at Berkeley Link to publication DOI Pre-print Media Attached | ||
06:00 20mTalk | Strategic Tree Rewriting in Attribute Grammars SLE Link to publication DOI Pre-print Media Attached |