X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=dsl%2Fclass_deep_embedding.tex;fp=dsl%2Fclass_deep_embedding.tex;h=8800a0fadd1071895f4e42a6823495fbfd523c91;hb=f9a4245726ba3e76b57d529b98e8cfe71beae99b;hp=a524e314c11f7961385be9b8f0d3e120268a36cc;hpb=b460fb90ed81b62d4b1c219271e29ece38c1ffab;p=phd-thesis.git 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.