From f9a4245726ba3e76b57d529b98e8cfe71beae99b Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Fri, 4 Nov 2022 09:28:27 +0100 Subject: [PATCH] updates --- dsl/class_deep_embedding.tex | 41 +++++++++++++++++++++++++++++++++++- dsl/dsl_techniques.tex | 32 ---------------------------- intro/intro.tex | 10 ++++----- preamble.tex | 1 + thesis.tex | 6 +++--- 5 files changed, 49 insertions(+), 41 deletions(-) diff --git a/dsl/class_deep_embedding.tex b/dsl/class_deep_embedding.tex index a524e31..8800a0f 100644 --- a/dsl/class_deep_embedding.tex +++ b/dsl/class_deep_embedding.tex @@ -682,6 +682,46 @@ Hybrid approaches between deep and shallow embedding exist as well. For example, \citet{svenningsson_combining_2013} show that by expressing the deeply embedded language in a shallowly embedded core language, extensions can be made orthogonally as well. This paper differs from those approaches in the sense that it does not require a core language in which all extensions need to be expressible. +\subsection{Comparison} +There is no silver bullet to embedding \glspl{DSL}. +\Citet{sun_compositional_2022} provided a thorough comparison of embedding techniques including more axes than just the two state in the expression problem. + +\Cref{tbl:dsl_comparison} shows an extended version of their comparison table. +Shallow includes regular shallow embedding. +Deep includes regular deep embedding and deep embedding with \glspl{GADT}. +Hybrid includes the many variants of hybrid embeddings. +Poly includes polymorphic embeddings, tagless-final embedding, and object algebras, as providing a unified encoding that allows extension both in language constructs and views. +Finally, classy denotes classy deep embedding. + +\begin{table}[ht] + \begin{threeparttable}[b] + \small + \caption{Comparison of embedding techniques, adapted from \citet[\citesection{3.6}]{sun_compositional_2022}}% + \label{tbl:dsl_comparison} + \begin{tabular}{llllllll} + \toprule + & Shallow & Deep & Hybrid & Poly & Comp. & \`a la & Classy\\ + \midrule + Extend constructs & \CIRCLE{} & \Circle{} & \LEFTcircle{}\tnote{1} & \CIRCLE{} & \CIRCLE{} & \Circle{} & \CIRCLE{}\\ + Extend interpretations & \Circle{} & \CIRCLE{} & \CIRCLE{} & \CIRCLE{} & \CIRCLE{} & \CIRCLE{} & \CIRCLE{}\\ + Transcoding free & \CIRCLE{} & \CIRCLE{} & \Circle{} & \CIRCLE{} & \CIRCLE{} & \CIRCLE{} & \CIRCLE{}\\ + Linguistic reuse & \CIRCLE{} & \Circle{} & \LEFTcircle{}\tnote{1} & \CIRCLE{} & \CIRCLE{} & \Circle{} & \Circle{}\\ + Transformations & \Circle{} & \CIRCLE{} & \CIRCLE{} & \LEFTcircle\tnote{2} & \LEFTcircle\tnote{2} & \CIRCLE{} & \CIRCLE{}\\ + Modular dependencies & \Circle{} & \LEFTcircle{} & \LEFTcircle{} & \CIRCLE{} & \CIRCLE{} & \LEFTcircle{} & \CIRCLE{}\\ + Nested pattern matching & \Circle{} & \CIRCLE{} & \CIRCLE{} & \Circle{} & \LEFTcircle{} & \CIRCLE{} & \LEFTcircle{}\tnote{3}\\ + Type safe & \CIRCLE{} & \LEFTcircle{} & \Circle{} & \CIRCLE{} & \CIRCLE{} & \LEFTcircle{} & \CIRCLE{}\\ + \bottomrule + \end{tabular} + \begin{tablenotes} + \item [1] Only in the shallowly embedded part. + \item [2] Transformations require some ingenuity and are sometimes awkward to write. + \item [3] It requires some---safe---form of dynamic typing. + \end{tablenotes} + \end{threeparttable} +\end{table} + + + \section*{Acknowledgements} This research is partly funded by the Royal Netherlands Navy. Furthermore, I would like to thank Pieter and Rinus for the fruitful discussions, Ralf for inspiring me to write a functional pearl, and the anonymous reviewers for their valuable and honest comments. @@ -689,7 +729,6 @@ Furthermore, I would like to thank Pieter and Rinus for the fruitful discussions \begin{subappendices} \section{Reprise: reducing boilerplate}% \label{sec:classy_reprise} -\todo{Improve text} One of the unique selling points of this novel \gls{DSL} embedding technique is that it, in its basic form, does not require advanced type system extensions nor a lot of boilerplate. However, generalising the technique to \glspl{GADT} arguably unleashes a cesspool of \emph{unsafe} compiler extensions. If we are willing to work with extensions, almost all of the boilerplate can be inferred or generated. diff --git a/dsl/dsl_techniques.tex b/dsl/dsl_techniques.tex index ca4ce11..7368d80 100644 --- a/dsl/dsl_techniques.tex +++ b/dsl/dsl_techniques.tex @@ -187,37 +187,5 @@ instance Sub Eval where sub x y = Eval (runEval x - runEval y) \end{lstHaskell} -\section{Other embedding techniques}\label{sec:other} -\section{Comparison}\label{sec:compare_embedding} -Both flavours have their strengths and weaknesses. -As we have seen with \glspl{GADT} for deep embedding and tagless-final for shallow embedding, both flavours can be improved in some way in order to mitigate (some of the) downsides. -Besides deep and shallow embedding, there are some more advanced variants that try to mitigate some of the problems. - -\begin{table}[ht] - \begin{threeparttable}[b] - \caption{Comparison of embedding techniques, adapted from \citet[\citesection{3.6}]{sun_compositional_2022}}% - \label{tbl:dsl_comparison} - \begin{tabular}{lllllll} - \toprule - & Shallow & Deep & Hybrid & Poly & Comp. & Classy\\ - \midrule - Transcoding free & yes & yes & no & yes & yes & yes\\ - Linguistic reuse & yes & no & partly\tnote{1} & yes & yes & no?\\ - Extend constructs & yes & no & partly\tnote{1} & yes & yes & yes\\ - Extend interpretations & no & yes & yes & yes & yes & yes\\ - Transformations & no & yes & yes & maybe\tnote{2} & maybe\tnote{2} & yes\\ - Modular dependencies & no & maybe & maybe & yes & yes & yes\\ - Nested pattern matching & no & yes & yes & no & maybe & maybe\tnote{3}\\ - Type safe & yes & maybe & no & yes & yes & yes\\ - \bottomrule - \end{tabular} - \begin{tablenotes} - \item [1] Only in the shallowly embedded part. - \item [2] Transformations require some ingenuity and are sometimes awkward to write. - \item [3] It requires some---safe---form of dynamic typing. - \end{tablenotes} - \end{threeparttable} -\end{table} - \input{subfilepostamble} \end{document} diff --git a/intro/intro.tex b/intro/intro.tex index 3180279..03d24cf 100644 --- a/intro/intro.tex +++ b/intro/intro.tex @@ -3,10 +3,9 @@ \input{subfilepreamble} \begin{document} -\chapter{Introduction}% +\chapter{Prelude --- Introduction}% \label{chp:introduction} \begin{chapterabstract} - \noindent% \begin{itemize} \item How many devices are there? @@ -18,7 +17,7 @@ \end{itemize} \item What is the {IoT}? \begin{itemize} - \item IoT is such a system + \item IoT is such a layered system \item Layers, device layer \end{itemize} \item What is impedance mismatch/semantic friction? @@ -36,8 +35,9 @@ \item This thesis: how to orchestrate this concerto of devices? \begin{itemize} \item Embedded devices require special code (different clef/key) - \item DSL is a special language in a language to facilitate this - \item mTask is a TOP language for IoT + \item DSL is a special language in a language to facilitate this (part 1) + \item mTask is a TOP language for IoT (part 2) + \item This approach is called tierless programming (part 3) \end{itemize} \end{itemize} diff --git a/preamble.tex b/preamble.tex index 8da86cd..04fb60c 100644 --- a/preamble.tex +++ b/preamble.tex @@ -11,6 +11,7 @@ \usepackage{titlecaps} % titlecase commands \usepackage{amsmath} % extra math \usepackage{amssymb} % extra math symbols +\usepackage{wasysym} % circle symbols \usepackage{relsize} % \smaller command \usepackage{siunitx} % typeset units \usepackage{xcolor} % colors diff --git a/thesis.tex b/thesis.tex index 461372e..52d5cc5 100644 --- a/thesis.tex +++ b/thesis.tex @@ -58,17 +58,17 @@ \subfile{intro/intro} % DSL -\part[\'Etude: Domain-Specific Languages]{\'Etude:\\[2ex]\smaller{}Domain-Specific Languages}% +\part[\'Etude --- Domain-Specific Languages]{\'Etude\\[2ex]\smaller{}Domain-Specific Languages}% \label{prt:dsl} \subfile{dsl/dsl_techniques} % DSL Techniques \subfile{dsl/class_deep_embedding} % Deep embedding with class \subfile{dsl/first-class_datatypes} % First-class data types -\part[Oratorio: Task-Oriented Programming]{Oratorio\\[2ex]\smaller{}Task-Oriented Programming for the Internet of Things}% +\part[Oratorio --- Task-Oriented Programming]{Oratorio\\[2ex]\smaller{}Task-Oriented Programming for the Internet of Things}% \label{prt:top} \subfile{top/top} % MTask tutorial and implementation -\part[Transformation: Tiered vs.\ Tierless Programming]{Transformation:\\[2ex]\smaller{}Tiered vs.\ Tierless Programming}% +\part[Transformation --- Tiered vs.\ Tierless Programming]{Transformation\\[2ex]\smaller{}Tiered vs.\ Tierless Programming}% \label{prt:tvt} \subfile{tvt/tvt} % Could Tierless Languages Reduce IoT Development Grief? -- 2.20.1