Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Giuseppe Castagna
occurrence-typing
Commits
f2ae707d
Commit
f2ae707d
authored
Jul 11, 2019
by
Giuseppe Castagna
Browse files
one line more
parent
aaa331b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
practical.tex
View file @
f2ae707d
...
...
@@ -173,18 +173,17 @@ We consider \True, \Any, and $\lnot\True$ as candidate types for
\end{alltt}
for which the very same types as in Table~
\ref
{
tab:implem
}
are deduced.
Last but not least Code~10 (
which
correspond
s
to our introductory
E
xample~
\ref
{
nest1
}
) illustrate the need for iterative refinement of
type environments, as defined in Section~
\ref
{
sec:typenv
}
.
Indeed, ha
s
we have
explained, a single pass analysis would deduce independently
Last but not least Code~10 (correspond
ing
to our introductory
e
xample~
\
eq
ref
{
nest1
}
) illustrate
s
the need for iterative refinement of
type environments, as defined in Section~
\ref
{
sec:typenv
}
.
A
s
explained, a single pass analysis would deduce independently
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
that
{
\tt
x
}
has type
\Empty
, that is that the first branch can never
be selected (and our implementation warns the user accordingly). In
hindsight, the only way for a well typed overloaded function to have
be selected (and our implementation warns the user accordingly). In 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
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,
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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment