Fluid quotes: metaprogramming across abstraction boundaries with dependent types

作者: Shadaj Laddad , Koushik Sen

DOI: 10.1145/3425898.3426953

关键词:

摘要: Object-oriented programming, functional and metaprogramming each offer a unique axis of abstraction that enables modular code. Macros, 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 call-site cannot analyze behind boundaries such variables methods. Furthermore, generated macro expansion exist compile-time be passed around user Multi-stage treats runtime values address this problem, but introduces cost running compiler when splicing quotes. This forces developers choose between low overhead modularity. What if we could have best both worlds? We introduce fluid quotes, new uses dependent types pass through while ahead-of-time. capabilities by eliminating traditional requirement co-locating parameter expressions call-sites. Fluid not source also associated context ensure correctness. In addition, composed into larger without any demonstrate two specific applications: optimizing data processing pipelines making language integrated queries more flexible.

参考文章(17)
Martin Odersky, Lex Spoon, Bill Venners, Programming in Scala ,(2008)
Steven E. Ganz, Amr Sabry, Walid Taha, Macros as multi-stage computations: type-safe, generative, binding macros in MacroML international conference on functional programming. ,vol. 36, pp. 74- 85 ,(2001) , 10.1145/507635.507646
W. H. Burge, Stream processing functions Ibm Journal of Research and Development. ,vol. 19, pp. 12- 25 ,(1975) , 10.1147/RD.191.0012
Duncan Coutts, Roman Leshchinskiy, Don Stewart, Stream fusion Proceedings of the 2007 ACM SIGPLAN international conference on Functional programming - ICFP '07. ,vol. 42, pp. 315- 326 ,(2007) , 10.1145/1291151.1291199
Walid Taha, Tim Sheard, Multi-stage programming with explicit annotations partial evaluation and semantic-based program manipulation. ,vol. 32, pp. 203- 217 ,(1997) , 10.1145/258993.259019
Eric Béguet, Manohar Jonnalagedda, Accelerating parser combinators with macros Proceedings of the Fifth Annual Scala Workshop. pp. 7- 17 ,(2014) , 10.1145/2637647.2637653
Shayan Najd, Sam Lindley, Josef Svenningsson, Philip Wadler, Everything old is new again: quoted domain-specific languages partial evaluation and semantic-based program manipulation. pp. 25- 36 ,(2016) , 10.1145/2847538.2847541
Manohar Jonnalagedda, Thierry Coppey, Sandro Stucki, Tiark Rompf, Martin Odersky, Staged parser combinators for efficient data processing conference on object-oriented programming systems, languages, and applications. ,vol. 49, pp. 637- 653 ,(2014) , 10.1145/2660193.2660241
Tiark Rompf, Martin Odersky, Lightweight modular staging: a pragmatic approach to runtime code generation and compiled DSLs generative programming and component engineering. ,vol. 46, pp. 127- 136 ,(2010) , 10.1145/1868294.1868314