ABSTRACT
Inlining is used in many different ways in programming languages: some languages use it as a compiler-directive solely for optimization, some use it as a metaprogramming feature, and others lay their design in-between. This paper presents inlining through the lens of metaprogramming and we describe a powerful set of metaprogramming constructs that help programmers to unfold domain-specific decisions at compile-time. In a multi-paradigm language like Scala, the concern for generality of inlining poses several interesting questions and the challenge we tackle is to offer inlining without changing the model seen by the programmer. In this paper, we explore these questions by explaining the rationale behind the design of Scala-3's inlining capability and how it relates to its metaprogramming architecture.
- Andrei Alexandrescu. 2010. <i>The D Programming Language: The D Programming Lan_p1</i>. Addison-Wesley Professional. Google ScholarDigital Library
- Eugene Burmako. 2017. <i>Unification of Compile-Time and Runtime Metaprogramming in Scala</i>. Ph.D. Dissertation. Lausanne.Google Scholar
- Rowan Davies and Frank Pfenning. 2001. A Modal Analysis of Staged Computation. <i>J. ACM</i> 48, 3 (May 2001), 555-604. Google ScholarDigital Library
- Timothy P Hart. 1963. MACRO definitions for LISP. (1963). Google ScholarDigital Library
- Oleg Kiselyov. 2014. The Design and Implementation of BER MetaO-Caml. In <i>Functional and Logic Programming</i>, Michael Codish and Eijiro Sumii (Eds.). Springer International Publishing, Cham, 86-102.Google Scholar
- Oleg Kiselyov, Aggelos Biboudis, Nick Palladinos, and Yannis Smaragdakis. 2017. Stream Fusion, to Completeness. In <i>Proc. of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages</i> (Paris, France) <i>(POPL '17)</i>. ACM, 285-299. Google ScholarDigital Library
- Oleg Kiselyov and Chung-chieh Shan. 2010. The MetaOCaml files - Status report and research proposal. In <i>ACM SIGPLAN Workshop on ML</i>.Google Scholar
- Yannis Lilis and Anthony Savidis. 2019. A Survey of Metaprogramming Languages. <i>ACM Comput. Surv.</i> 52, 6, Article 113 (Oct. 2019), 39 pages. <pub-id pub-id-type="doi" xlink:href="10.1145/3354584" assigning-authority="crossref">10.1145/3354584</pub-id>. Google ScholarDigital Library
- Martin Odersky, Eugene Burmako, and Dmytro Petrashko. 2016. A TASTY Alternative. (2016).Google Scholar
- Tiark Rompf and Martin Odersky. 2010. Lightweight Modular Staging: A Pragmatic Approach to Runtime Code Generation and Compiled DSLs. In <i>Proc. of the Ninth International Conference on Generative Programming and Component Engineering</i> (Eindhoven, The Netherlands) <i>(GPCE '10)</i>. ACM, New York, NY, USA, 127-136. Google ScholarDigital Library
- Yannis Smaragdakis, Aggelos Biboudis, and George Fourtounis. 2017. Structured Program Generation Techniques. In <i>Grand Timely Topics in Software Engineering</i>, Jácome Cunha, João P. Fernandes, Ralf Lämmel, João Saraiva, and Vadim Zaytsev (Eds.). Springer International Publishing, Cham, 154-178.Google Scholar
- Bjarne Stroustrup. 2000. <i>The C++ programming language</i>. Pearson Education India. Google ScholarDigital Library
- Nicolas Stucki, Aggelos Biboudis, and Martin Odersky. 2018. A Practical Uni_cation of Multi-stage Programming and Macros. In <i>Proceedings of the 17th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences</i> (Boston, MA, USA) <i>(GPCE 2018)</i>. ACM, New York, NY, USA, 14-27. Google ScholarDigital Library
- Don Syme. 2012. The F# 3.0 Language Specification. https://web.archive.org/web/20170325225238/http://fsharp.org/specs/language-spec/3.0/FSharpSpec-3.0-final.pdf.Google Scholar
- Walid Taha. 2004. A Gentle Introduction to Multi-stage Programming. In <i>Domain-Specific Program Generation: International Seminar, Dagstuhl Castle, Germany, March 23-28, 2003. Revised Papers</i>, Christian Lengauer, Don Batory, Charles Consel, and Martin Odersky (Eds.). Number 3016. Springer Berlin Heidelberg, 30-50.Google Scholar
- Walid Taha and Michael Florentin Nielsen. 2003. Environment Classifiers. In <i>In Proc. of the 30th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages</i> (New Orleans, Louisiana, USA) <i>(POPL '03)</i>. ACM, New York, NY, USA, 26-37. Google ScholarDigital Library
- Walid Taha and Tim Sheard. 1997. Multi-stage Programming with Explicit Annotations. In <i>In Proc. of the 1997 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation</i> (Amsterdam, The Netherlands) <i>(PEPM '97)</i>. ACM, New York, NY, USA, 203-217. Google ScholarDigital Library
- The Dotty Team. 2018. Dotty Compiler: A Next Generation Compiler for Scala. https://web.archive.org/web/20180630221002/http://dotty.epfl.ch/.Google Scholar
Index Terms
- Semantics-preserving inlining for metaprogramming
Recommendations
Backstage Java: making a difference in metaprogramming
OOPSLA '11We propose Backstage Java (BSJ), a Java language extension which allows algorithmic, contextually-aware generation and transformation of code. BSJ explicitly and concisely represents design patterns and other encodings by employing compile-time ...
Backstage Java: making a difference in metaprogramming
OOPSLA '11: Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applicationsWe propose Backstage Java (BSJ), a Java language extension which allows algorithmic, contextually-aware generation and transformation of code. BSJ explicitly and concisely represents design patterns and other encodings by employing compile-time ...
Explicitly heterogeneous metaprogramming with MetaHaskell
ICFP '12: Proceedings of the 17th ACM SIGPLAN international conference on Functional programmingLanguages with support for metaprogramming, like MetaOCaml, offer a principled approach to code generation by guaranteeing that well-typed metaprograms produce well-typed programs. However, many problem domains where metaprogramming can fruitfully be ...
Comments