File Download
  Links for fulltext
     (May Require Subscription)
Supplementary

Article: Shallow EDSLs and Object-Oriented Programming: Beyond Simple Compositionality

TitleShallow EDSLs and Object-Oriented Programming: Beyond Simple Compositionality
Authors
Keywordsembedded domain-specific languages
shallow embedding
object-oriented programming
Issue Date2019
PublisherAOSA, Inc. The Journal's web site is located at https://programming-journal.org/
Citation
The Art, Science, and Engineering of Programming, 2019, v. 3 n. 3, p. article no. 10 How to Cite?
AbstractContext. 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 abstraction. The knowledge about this relationship enables us to improve on implementation techniques for EDSLs. Knowledge. This paper argues that common OOP mechanisms (including inheritance, subtyping, and type-refinement) increase the modularity and reuse of shallow EDSLs when compared to classical procedural abstraction by enabling a simple way to express multiple, possibly dependent, interpretations. Grounding. We make our arguments by using Gibbons and Wu’s examples, where procedural abstraction is used in Haskell to model a simple shallow EDSL. We recode that EDSL in Scala and with an improved OO-inspired Haskell encoding. We further illustrate our approach with a case study on refactoring a deep external SQL query processor to make it more modular, shallow, and embedded. Importance. This work is important for two reasons. Firstly, from an intellectual point of view, this work establishes the connection between shallow embeddings and OOP, which enables a better understanding of both concepts. Secondly, this work illustrates programming techniques that can be used to improve the modularity and reuse of shallow EDSLs.
Persistent Identifierhttp://hdl.handle.net/10722/301474
ISSN

 

DC FieldValueLanguage
dc.contributor.authorZHANG, W-
dc.contributor.authorOliveira, B-
dc.date.accessioned2021-07-27T08:11:37Z-
dc.date.available2021-07-27T08:11:37Z-
dc.date.issued2019-
dc.identifier.citationThe Art, Science, and Engineering of Programming, 2019, v. 3 n. 3, p. article no. 10-
dc.identifier.issn2473-7321-
dc.identifier.urihttp://hdl.handle.net/10722/301474-
dc.description.abstractContext. 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 abstraction. The knowledge about this relationship enables us to improve on implementation techniques for EDSLs. Knowledge. This paper argues that common OOP mechanisms (including inheritance, subtyping, and type-refinement) increase the modularity and reuse of shallow EDSLs when compared to classical procedural abstraction by enabling a simple way to express multiple, possibly dependent, interpretations. Grounding. We make our arguments by using Gibbons and Wu’s examples, where procedural abstraction is used in Haskell to model a simple shallow EDSL. We recode that EDSL in Scala and with an improved OO-inspired Haskell encoding. We further illustrate our approach with a case study on refactoring a deep external SQL query processor to make it more modular, shallow, and embedded. Importance. This work is important for two reasons. Firstly, from an intellectual point of view, this work establishes the connection between shallow embeddings and OOP, which enables a better understanding of both concepts. Secondly, this work illustrates programming techniques that can be used to improve the modularity and reuse of shallow EDSLs.-
dc.languageeng-
dc.publisherAOSA, Inc. The Journal's web site is located at https://programming-journal.org/-
dc.relation.ispartofThe Art, Science, and Engineering of Programming-
dc.rightsThis work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.-
dc.subjectembedded domain-specific languages-
dc.subjectshallow embedding-
dc.subjectobject-oriented programming-
dc.titleShallow EDSLs and Object-Oriented Programming: Beyond Simple Compositionality-
dc.typeArticle-
dc.identifier.emailOliveira, B: bruno@cs.hku.hk-
dc.identifier.authorityOliveira, B=rp01786-
dc.description.naturepublished_or_final_version-
dc.identifier.doi10.22152/programming-journal.org/2019/3/10-
dc.identifier.hkuros323730-
dc.identifier.volume3-
dc.identifier.issue3-
dc.identifier.spagearticle no. 10-
dc.identifier.epagearticle no. 10-
dc.publisher.placeUnited States-

Export via OAI-PMH Interface in XML Formats


OR


Export to Other Non-XML Formats