Commit f2ae707d authored by Giuseppe Castagna's avatar Giuseppe Castagna
Browse files

one line more

parent aaa331b3
...@@ -173,18 +173,17 @@ We consider \True, \Any, and $\lnot\True$ as candidate types for ...@@ -173,18 +173,17 @@ We consider \True, \Any, and $\lnot\True$ as candidate types for
\end{alltt} \end{alltt}
for which the very same types as in Table~\ref{tab:implem} are deduced. for which the very same types as in Table~\ref{tab:implem} are deduced.
Last but not least Code~10 (which corresponds to our introductory Last but not least Code~10 (corresponding to our introductory
Example~\ref{nest1}) illustrate the need for iterative refinement of example~\eqref{nest1}) illustrates the need for iterative refinement of
type environments, as defined in Section~\ref{sec:typenv}. Indeed, has type environments, as defined in Section~\ref{sec:typenv}. As
we have explained, a single pass analysis would deduce independently explained, a single pass analysis would deduce independently
for {\tt x} for {\tt x}
a type \Int from the {\tt f~x} application and \Any from the {\tt g~x} a type \Int{} from the {\tt f\;x} application and \Any{} from the {\tt g\;x}
application. Here by iterating a second time, the algorithm deduces application. Here by iterating a second time, the algorithm deduces
that {\tt x} has type \Empty, that is that the first branch can never that {\tt x} has type \Empty, that is that the first branch can never
be selected (and our implementation warns the user accordingly). In be selected (and our implementation warns the user accordingly). In hindsight, the only way for a well-typed overloaded function to have
hindsight, the only way for a well typed overloaded function to have
type $(\Int\to\Int)\land(\Any\to\Bool)$ is to diverge when the type $(\Int\to\Int)\land(\Any\to\Bool)$ is to diverge when the
argument is of type \Int (since this intersection types states that argument is of type \Int: since this intersection types states that
whenever the input is \Int, {\em both\/} branches can be selected, whenever the input is \Int, {\em both\/} branches can be selected,
yielding a result that is at the same time an integer and a Boolean. yielding a result that is at the same time an integer and a Boolean.
This is precisely reflected by the case $\Int\to\Empty$ in the result. This is precisely reflected by the case $\Int\to\Empty$ in the result.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment