Start Wildcard Elimination Beispiel
This commit is contained in:
parent
22a8f80484
commit
e92d008a6c
73
vortrag.tex
73
vortrag.tex
@ -22,9 +22,9 @@
|
|||||||
}
|
}
|
||||||
\input{einstellungen_liste} % verfügbare Einstellungen
|
\input{einstellungen_liste} % verfügbare Einstellungen
|
||||||
%\input{einstellungen} % lese Einstellungen
|
%\input{einstellungen} % lese Einstellungen
|
||||||
\setzetitel{Scala-like function types in Featherweight Java}
|
\setzetitel{Typeinferenz für Java mit Wildcards}
|
||||||
\setzeuntertitel{Bad Honnef 2022}
|
\setzeuntertitel{Bad Honnef 2024}
|
||||||
\setzedatum{2. Mai 2022}
|
\setzedatum{30. April 2024}
|
||||||
\setzestudiengang{Stuidengang Informatik}
|
\setzestudiengang{Stuidengang Informatik}
|
||||||
\setzedhbw{DHBW Stuttgart Campus Horb}
|
\setzedhbw{DHBW Stuttgart Campus Horb}
|
||||||
\setzeinternetadresse{www.dhbw-stuttgart.de/horb}
|
\setzeinternetadresse{www.dhbw-stuttgart.de/horb}
|
||||||
@ -625,9 +625,9 @@ shuffle2D(l); // Fehler!
|
|||||||
\begin{lstlisting}
|
\begin{lstlisting}
|
||||||
(*@\only<2>{$\color{red}\tv{r}$ }@*)someList(){
|
(*@\only<2>{$\color{red}\tv{r}$ }@*)someList(){
|
||||||
if(Math.random > 0.5){
|
if(Math.random > 0.5){
|
||||||
return new List<String>();
|
return new List("String");
|
||||||
} else {
|
} else {
|
||||||
return new List<Integer>();
|
return new List(42);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\end{lstlisting}
|
\end{lstlisting}
|
||||||
@ -642,10 +642,11 @@ $\\[1em]
|
|||||||
\wildcardEnv \vdash C \cup \wctype{\Delta}{C}{\ol{T}} \lessdot \ntv{a}\\
|
\wildcardEnv \vdash C \cup \wctype{\Delta}{C}{\ol{T}} \lessdot \ntv{a}\\
|
||||||
\hline
|
\hline
|
||||||
\wildcardEnv \vdash C \cup \set{\wctype{\Delta}{C}{\ol{T}} \lessdot \ntv{a},
|
\wildcardEnv \vdash C \cup \set{\wctype{\Delta}{C}{\ol{T}} \lessdot \ntv{a},
|
||||||
\ntv{a} \doteq \wctype{\overline{\rwildcard{X}}}{C}{\overline{\rwildcard{X}}}
|
\ntv{a} \doteq \wctype{\overline{\wildcard{A}{\tv{u}}{\tv{l}}}}{C}{\overline{\rwildcard{A}}}
|
||||||
}
|
}
|
||||||
\end{array} \quad \begin{array}[c]{l}
|
\end{array} \quad \begin{array}[c]{l}
|
||||||
\texttt{class} \ \exptype{C}{\ol{X \triangleleft \type{S}}} \triangleleft \exptype{D}{\ol{N}} \\
|
\texttt{class} \ \exptype{C}{\ol{X}} \set{\ldots }\\%\triangleleft \exptype{D}{\ol{N}} \\
|
||||||
|
\tv{u}, \tv{l}\ \text{fresh}
|
||||||
\end{array}
|
\end{array}
|
||||||
$
|
$
|
||||||
\\[1em]
|
\\[1em]
|
||||||
@ -653,19 +654,71 @@ $\\[1em]
|
|||||||
$
|
$
|
||||||
\exptype{List}{String} \lessdot {\tv{r}},
|
\exptype{List}{String} \lessdot {\tv{r}},
|
||||||
\exptype{List}{Integer} \lessdot {\tv{r}},
|
\exptype{List}{Integer} \lessdot {\tv{r}},
|
||||||
\highlight{\tv{r} \doteq \wctype{\rwildcard{X}}{List}{\rwildcard{X}}}
|
\highlight{\tv{r} \doteq \wctype{\wildcard{X}{\tv{u}}{\tv{l}}}{List}{\rwildcard{X}}}
|
||||||
$
|
$
|
||||||
\pause
|
\pause
|
||||||
\\[0.5em]
|
\\[0.5em]
|
||||||
\textbf{Substitution:}
|
\textbf{Substitution:}
|
||||||
|
|
||||||
$
|
$
|
||||||
\exptype{List}{String} \lessdot \highlight{\wctype{\rwildcard{X}}{List}{\rwildcard{X}}},
|
\exptype{List}{String} \lessdot \highlight{\wctype{\wildcard{X}{\tv{u}}{\tv{l}}}{List}{\rwildcard{X}}},
|
||||||
\exptype{List}{Integer} \lessdot \highlight{\wctype{\rwildcard{X}}{List}{\rwildcard{X}}},
|
\exptype{List}{Integer} \lessdot \highlight{\wctype{\wildcard{X}{\tv{u}}{\tv{l}}}{List}{\rwildcard{X}}}
|
||||||
|
$
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}[fragile]
|
||||||
|
$
|
||||||
|
\begin{array}{l}
|
||||||
|
\exptype{List}{String} \lessdot \highlight{\wctype{\wildcard{X}{\tv{u}}{\tv{l}}}{List}{\rwildcard{X}}},
|
||||||
|
\exptype{List}{Integer} \lessdot \highlight{\wctype{\wildcard{X}{\tv{u}}{\tv{l}}}{List}{\rwildcard{X}}}
|
||||||
|
\\
|
||||||
|
\hline
|
||||||
|
\type{String} \doteq \wtv{x1}, \type{Integer} \doteq \wtv{x2}
|
||||||
|
\end{array}
|
||||||
|
\rulenameAfter{Reduce}
|
||||||
$
|
$
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
\begin{frame}[fragile]{Wildcard Elminiation}
|
\begin{frame}[fragile]{Wildcard Elminiation}
|
||||||
|
\begin{lstlisting}
|
||||||
|
<X> List<X> concat(List<X> l1, List<X> l2){ ... }
|
||||||
|
someList(){
|
||||||
|
if(Math.random > 0.5){
|
||||||
|
return new List("String");
|
||||||
|
} else {
|
||||||
|
return new List(42);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
concat(someList(), someList())
|
||||||
|
\end{lstlisting}
|
||||||
|
|
||||||
|
\only<1>{\textbf{Input}:}
|
||||||
|
$\only<2>{\highlight{\rulename{General}}}$
|
||||||
|
$\only<3>{\highlight{\rulename{Reduce}}}$
|
||||||
|
|
||||||
|
$
|
||||||
|
\begin{array}{l}
|
||||||
|
\exptype{List}{String} \lessdot {\tv{r}},
|
||||||
|
\exptype{List}{Integer} \lessdot {\tv{r}},
|
||||||
|
\tv{r} \lessdotCC \exptype{List}{\wtv{x}},
|
||||||
|
\tv{r} \lessdotCC \exptype{List}{\wtv{x}}
|
||||||
|
\pause
|
||||||
|
\\
|
||||||
|
\hline
|
||||||
|
\exptype{List}{String} \lessdot \only<2>{\highlight}{\wctype{\wildcard{X}{\tv{u}}{\tv{l}}}{List}{\rwildcard{X}}},
|
||||||
|
\exptype{List}{Integer} \lessdot \only<2>{\highlight}{\wctype{\wildcard{X}{\tv{u}}{\tv{l}}}{List}{\rwildcard{X}}},\\
|
||||||
|
\only<2>{\highlight}{\wctype{\wildcard{X}{\tv{u}}{\tv{l}}}{List}{\rwildcard{X}}} \lessdotCC \exptype{List}{\wtv{x}},
|
||||||
|
\only<2>{\highlight}{\wctype{\wildcard{X}{\tv{u}}{\tv{l}}}{List}{\rwildcard{X}}} \lessdotCC \exptype{List}{\wtv{x}}
|
||||||
|
\pause
|
||||||
|
\\
|
||||||
|
\hline
|
||||||
|
\highlight{\type{String} \doteq \wtv{x1}, \wtv{x1} \lessdot \tv{u}, \tv{l} \lessdot \wtv{x1},
|
||||||
|
\type{Integer} \doteq \wtv{x2}, \wtv{x2} \lessdot \tv{u}, \tv{l} \lessdot \wtv{x2}}, \\
|
||||||
|
\only<2>{\highlight}{\wctype{\wildcard{X}{\tv{u}}{\tv{l}}}{List}{\rwildcard{X}}} \lessdotCC \exptype{List}{\wtv{x}},
|
||||||
|
\only<2>{\highlight}{\wctype{\wildcard{X}{\tv{u}}{\tv{l}}}{List}{\rwildcard{X}}} \lessdotCC \exptype{List}{\wtv{x}}
|
||||||
|
\end{array}$
|
||||||
|
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
% wieso dürfen normale Typvariablen keine freien Variablen enthalten?
|
% wieso dürfen normale Typvariablen keine freien Variablen enthalten?
|
||||||
|
Loading…
Reference in New Issue
Block a user