Start Wildcard creation example

This commit is contained in:
JanUlrich 2024-05-01 21:37:27 +02:00
parent 52f1cf631f
commit 85fd47eb6a

View File

@ -7,6 +7,19 @@
\section{Unify}\label{sec:unify} \section{Unify}\label{sec:unify}
\subsection{Adding Wildcards to the mix}
%Wildcard creation. % TODO: Explain by the example from the Bad Honnef Talk
%Wildcards are bound to a type.
% and can therefore only be created at T <. a constraints
% After a reduce step the information to which Type the wildcard was bound is lost!
\begin{lstlisting}
<X> List<X> concat(List<X> l, List<X> r){ ... }
someList(){
return new List("String") :? new List(42);
}
\end{lstlisting}
\subsection{Description} \subsection{Description}
The \unify{} algorithm tries to find a solution for a set of constraints like The \unify{} algorithm tries to find a solution for a set of constraints like
$\set{\exptype{List}{String} \lessdot \tv{a}, \exptype{List}{Integer} \lessdot \tv{a}}$. $\set{\exptype{List}{String} \lessdot \tv{a}, \exptype{List}{Integer} \lessdot \tv{a}}$.