From 921adc85b121828b87f0f441598e149bad3dc196 Mon Sep 17 00:00:00 2001 From: Andreas Stadelmeier Date: Wed, 31 Jan 2024 18:05:22 +0100 Subject: [PATCH] Start let insert example --- introduction.tex | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/introduction.tex b/introduction.tex index ca5c1a5..6a57dd3 100644 --- a/introduction.tex +++ b/introduction.tex @@ -45,7 +45,30 @@ List genList() { \end{subfigure} %\caption{Example code} %\label{fig:intro-example-code} - \end{figure} +\end{figure} + + +In \cite{WildcardsNeedWitnessProtection} existential types have to be \textit{unpacked} before they can be used. +Our type inference algorithm has to add let statements surrounding method invocations. +\begin{figure}[tp] + \begin{subfigure}[t]{0.49\linewidth} + \begin{lstlisting}[style=fgj] + List ls = ...; + ls.add(new Integer()); + \end{lstlisting} + \caption{Method invocation} + \label{fig:intro-example-typeless} + \end{subfigure} + ~ + \begin{subfigure}[t]{0.49\linewidth} + \begin{lstlisting}[style=tfgj] + List ls = ...; + ls.add(new Integer()); + \end{lstlisting} + \caption{Capture Conversion by \texttt{let}-statement} + \label{fig:intro-example-typed} + \end{subfigure} +\end{figure} % \subsection{Wildcards} % Java subtyping involving generics is invariant.