updates
authorMart Lubbers <mart@martlubbers.net>
Fri, 4 Nov 2022 15:31:10 +0000 (16:31 +0100)
committerMart Lubbers <mart@martlubbers.net>
Fri, 4 Nov 2022 15:31:10 +0000 (16:31 +0100)
dsl/class_deep_embedding.tex

index 8800a0f..589c2f9 100644 (file)
@@ -683,45 +683,63 @@ For example, \citet{svenningsson_combining_2013} show that by expressing the dee
 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}
+\todo[inline]{text moet beter}
 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.
+\Citet{sun_compositional_2022} provided a thorough comparison of embedding techniques including more axes than just the two statet 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.
+\Cref{tbl:dsl_comparison} shows a variant of their comparison table.
+The first two rows describe the two axes of the original expression problem and the third row describes theadded axis of modular dependency handling as stated by \citeauthor{sun_compositional_2022}.
+The \emph{poly.} style of embedding---including tagless-final---falls short of this requirement.
+
+Intensional analysis is an umbrella term for pattern matching and transformations.
+In shallow embedding, intensional analysis is more complex and requires stateful views describing context but it is possible to implement though.
+
+Simple type system describes the whether it is possible to encode this embedding technique with many type system extensions.
+In classy deep embedding, there is either a bit more scaffolding and boilerplate required or advanced type system extensions need to be used.
+
+Little boilerplate denotes the amount of scaffolding and boilerplate required.
+For example, hybrid embedding requires a transcoding step between the deep syntax and the shallow core language.
 
 \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}
+               \caption{Comparison of embedding techniques, extended from \citet[\citesection{3.6}]{sun_compositional_2022}.}%
+               \label{tbl:dsl_comparison_brief}
                \begin{tabular}{llllllll}
                        \toprule
-                                                                       & Shallow   & Deep          & Hybrid                 & Poly                 & Comp.                & \`a la & Classy\\
+                                                                & 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{}\\
+                       Extend constructs    & \CIRCLE{}              & \Circle{}              & \LEFTcircle{}\tnote{1}
+                                                                & \CIRCLE{}              & \CIRCLE{}              & \CIRCLE{}
+                                                                & \CIRCLE{}\\
+                       Extend views         & \Circle{}              & \CIRCLE{}              & \CIRCLE{}
+                                                                & \CIRCLE{}              & \CIRCLE{}              & \CIRCLE{}
+                                                                & \CIRCLE{}\\
+                       Modular dependencies & \Circle{}              & \CIRCLE{}              & \CIRCLE{}
+                                                                & \Circle{}              & \CIRCLE{}              & \CIRCLE{}
+                                                                & \CIRCLE{}\\
+                       Intensional analysis & \LEFTcircle{}\tnote{2} & \CIRCLE{}              & \CIRCLE{}
+                                                                & \LEFTcircle{}\tnote{2} & \LEFTcircle{}\tnote{2} & \CIRCLE{}
+                                                                & \LEFTcircle{}\tnote{3}\\
+                       Simple type system   & \CIRCLE{}              & \CIRCLE{}              & \Circle{}
+                                                                & \CIRCLE{}              & \CIRCLE{}              & \Circle{}
+                                                                & \LEFTcircle{}\tnote{4}\\
+                       Little boilerplate   & \CIRCLE{}              & \CIRCLE{}              & \Circle{}
+                                                                & \CIRCLE{}              & \CIRCLE{}              & \Circle{}
+                                                                & \LEFTcircle{}\tnote{4}\\
                        \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.
+                       \item [1] Only if the extension is expressible in the core language.
+                       \item [2] Requires ingenuity and are sometimes awkward to write.
+                       \item [3] Cross-extensional pattern matching requires \emph{safe} dynamic typing.
+                       \item [4] Either a simple type system or little boilerplate.
                \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.