Repository logo

Infoscience

  • English
  • French
Log In
Logo EPFL, École polytechnique fédérale de Lausanne

Infoscience

  • English
  • French
Log In
  1. Home
  2. Academic and Research Output
  3. Conferences, Workshops, Symposiums, and Seminars
  4. Squid: Type-Safe, Hygienic, and Reusable Quasiquotes
 
conference paper

Squid: Type-Safe, Hygienic, and Reusable Quasiquotes

Parreaux, Lionel  
•
Shaikhha, Amir  
•
Koch, Christoph  
2017
Proceedings of 8th ACM SIGPLAN International Scala Symposium (SCALA’17)
8th ACM SIGPLAN International Scala Symposium (SCALA'17)

Quasiquotes have been shown to greatly simplify the task of metaprogramming. This is in part because they hide the data structures of the intermediate representation (IR), instead allowing metaprogrammers to use the concrete syntax of the language they manipulate. Scala has had ``syntactic'' quasiquotes for a long time, but still misses a statically-typed version like in MetaOCaml, Haskell and F#. This safer flavor of quasiquotes has been particularly useful for staging and domain-specific languages. In this paper we present Squid, a metaprogramming system for Scala that fills this gap. Squid quasiquotes are novel in three ways: they are the first statically-typed quasiquotes we know that allow code inspection (via pattern matching); they are implemented purely as a macro library, without modifications to the compiler; and they are reusable in the sense that they can manipulate different IRs. Adapting (or binding) a new IR to Squid is done simply by implementing a well-defined interface in the style of object algebras (i.e., tagless-final). We detail how Squid is implemented, leveraging the metaprogramming tools already offered by Scala, and show three application examples: the definition of a binding for a DSL in the style of LMS; a safe ANF conversion; and the introduction of type-safe, hygienic macros as an alternative to the current macro system.

  • Files
  • Details
  • Metrics
Type
conference paper
DOI
10.1145/3136000.3136005
Author(s)
Parreaux, Lionel  
Shaikhha, Amir  
Koch, Christoph  
Date Issued

2017

Publisher

ACM

Publisher place

New York, NY, USA

Published in
Proceedings of 8th ACM SIGPLAN International Scala Symposium (SCALA’17)
ISBN of the book

978-1-4503-5529-2/17/10

Subjects

Quasiquotes

•

Type-Safety

•

Embedded Domain-Specific Languages

URL

URL

https://conf.researchr.org/event/scala-2017/scala-2017-papers-squid-type-safe-hygienic-and-reusable-quasiquotes
Editorial or Peer reviewed

REVIEWED

Written at

EPFL

EPFL units
DATA  
Event nameEvent placeEvent date
8th ACM SIGPLAN International Scala Symposium (SCALA'17)

Vancouver, Canada

October 22–23, 2017

Available on Infoscience
October 9, 2017
Use this identifier to reference this record
https://infoscience.epfl.ch/handle/20.500.14299/141308
Logo EPFL, École polytechnique fédérale de Lausanne
  • Contact
  • infoscience@epfl.ch

  • Follow us on Facebook
  • Follow us on Instagram
  • Follow us on LinkedIn
  • Follow us on X
  • Follow us on Youtube
AccessibilityLegal noticePrivacy policyCookie settingsEnd User AgreementGet helpFeedback

Infoscience is a service managed and provided by the Library and IT Services of EPFL. © EPFL, tous droits réservés