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.
\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.
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}
\input{subfilepreamble}
\begin{document}
-\chapter{Introduction}%
+\chapter{Prelude --- Introduction}%
\label{chp:introduction}
\begin{chapterabstract}
-
\noindent%
\begin{itemize}
\item How many devices are there?
\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?
\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}
\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
\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?