skip to main content
10.1145/3426426.3428486acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

Semantics-preserving inlining for metaprogramming

Published:13 November 2020Publication History

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.

References

  1. Andrei Alexandrescu. 2010. <i>The D Programming Language: The D Programming Lan_p1</i>. Addison-Wesley Professional. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Eugene Burmako. 2017. <i>Unification of Compile-Time and Runtime Metaprogramming in Scala</i>. Ph.D. Dissertation. Lausanne.Google ScholarGoogle Scholar
  3. Rowan Davies and Frank Pfenning. 2001. A Modal Analysis of Staged Computation. <i>J. ACM</i> 48, 3 (May 2001), 555-604. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Timothy P Hart. 1963. MACRO definitions for LISP. (1963). Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 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 ScholarGoogle Scholar
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. Oleg Kiselyov and Chung-chieh Shan. 2010. The MetaOCaml files - Status report and research proposal. In <i>ACM SIGPLAN Workshop on ML</i>.Google ScholarGoogle Scholar
  8. Yannis Lilis and Anthony Savidis. 2019. A Survey of Metaprogramming Languages. &lt;i&gt;ACM Comput. Surv.&lt;/i&gt; 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. Martin Odersky, Eugene Burmako, and Dmytro Petrashko. 2016. A TASTY Alternative. (2016).Google ScholarGoogle Scholar
  10. Tiark Rompf and Martin Odersky. 2010. Lightweight Modular Staging: A Pragmatic Approach to Runtime Code Generation and Compiled DSLs. In &lt;i&gt;Proc. of the Ninth International Conference on Generative Programming and Component Engineering&lt;/i&gt; (Eindhoven, The Netherlands) &lt;i&gt;(GPCE '10)&lt;/i&gt;. ACM, New York, NY, USA, 127-136. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Yannis Smaragdakis, Aggelos Biboudis, and George Fourtounis. 2017. Structured Program Generation Techniques. In &lt;i&gt;Grand Timely Topics in Software Engineering&lt;/i&gt;, J&#225;come Cunha, Jo&#227;o P. Fernandes, Ralf L&#228;mmel, Jo&#227;o Saraiva, and Vadim Zaytsev (Eds.). Springer International Publishing, Cham, 154-178.Google ScholarGoogle Scholar
  12. Bjarne Stroustrup. 2000. &lt;i&gt;The C++ programming language&lt;/i&gt;. Pearson Education India. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Nicolas Stucki, Aggelos Biboudis, and Martin Odersky. 2018. A Practical Uni_cation of Multi-stage Programming and Macros. In &lt;i&gt;Proceedings of the 17th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences&lt;/i&gt; (Boston, MA, USA) &lt;i&gt;(GPCE 2018)&lt;/i&gt;. ACM, New York, NY, USA, 14-27. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle Scholar
  15. Walid Taha. 2004. A Gentle Introduction to Multi-stage Programming. In &lt;i&gt;Domain-Specific Program Generation: International Seminar, Dagstuhl Castle, Germany, March 23-28, 2003. Revised Papers&lt;/i&gt;, Christian Lengauer, Don Batory, Charles Consel, and Martin Odersky (Eds.). Number 3016. Springer Berlin Heidelberg, 30-50.Google ScholarGoogle Scholar
  16. Walid Taha and Michael Florentin Nielsen. 2003. Environment Classifiers. In &lt;i&gt;In Proc. of the 30th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages&lt;/i&gt; (New Orleans, Louisiana, USA) &lt;i&gt;(POPL '03)&lt;/i&gt;. ACM, New York, NY, USA, 26-37. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Walid Taha and Tim Sheard. 1997. Multi-stage Programming with Explicit Annotations. In &lt;i&gt;In Proc. of the 1997 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation&lt;/i&gt; (Amsterdam, The Netherlands) &lt;i&gt;(PEPM '97)&lt;/i&gt;. ACM, New York, NY, USA, 203-217. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. The Dotty Team. 2018. Dotty Compiler: A Next Generation Compiler for Scala. https://web.archive.org/web/20180630221002/http://dotty.epfl.ch/.Google ScholarGoogle Scholar

Index Terms

  1. Semantics-preserving inlining for metaprogramming

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          SCALA 2020: Proceedings of the 11th ACM SIGPLAN International Symposium on Scala
          November 2020
          33 pages
          ISBN:9781450381772
          DOI:10.1145/3426426

          Copyright © 2020 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 13 November 2020

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article

          Acceptance Rates

          Overall Acceptance Rate5of6submissions,83%

          Upcoming Conference

          PLDI '24

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader