Shallow EDSLs and Object-Oriented Programming: Beyond Simple Compositionality
Weixin Zhang (The University of Hong Kong, Hong Kong), Bruno Oliveira, (The University of Hong Kong, Hong Kong)

TL;DR
This paper explores the relationship between shallow EDSLs and Object-Oriented Programming, demonstrating how OOP mechanisms enhance modularity and reuse in EDSL implementation, supported by case studies and code examples.
Contribution
It establishes a formal connection between shallow EDSLs and OOP, showing how OOP features improve modularity and interpretative flexibility in EDSLs.
Findings
OOP mechanisms increase modularity in shallow EDSLs
Recasting EDSLs in OOP improves interpretative flexibility
Case study shows improved modularity in SQL query processor
Abstract
Context: Embedded Domain-Specific Languages (EDSLs) are a common and widely used approach to DSLs in various languages, including Haskell and Scala. There are two main implementation techniques for EDSLs: shallow embeddings and deep embeddings. Inquiry: Shallow embeddings are quite simple, but they have been criticized in the past for being quite limited in terms of modularity and reuse. In particular, it is often argued that supporting multiple DSL interpretations in shallow embeddings is difficult. Approach: This paper argues that shallow EDSLs and Object-Oriented Programming (OOP) are closely related. Gibbons and Wu already discussed the relationship between shallow EDSLs and procedural abstraction, while Cook discussed the connection between procedural abstraction and OOP. We make the transitive step in this paper by connecting shallow EDSLs directly to OOP via procedural…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
