1
1
\chapter {Evaluation }
2
2
\label {cha:evaluation }
3
3
In this chapter we present three type system specifications, discuss
4
- how the specification language effected the formulation of typing
4
+ how the specification language affected the formulation of typing
5
5
rules, and which optimization strategies are successful.
6
6
\section {SytemF }
7
7
\label {sec:sytemf }
@@ -10,7 +10,7 @@ \section{SytemF}
10
10
~\cite {Pierce:2002:TPL:509043 }. The complete implementation can be
11
11
found in Appendix~\ref {appendix:systemf }. There are three notable
12
12
differences between the version in~\cite {Pierce:2002:TPL:509043 } and
13
- our implementation, that we describe in the following.
13
+ our implementation, which we will describe in the following.
14
14
15
15
In~\cite {Pierce:2002:TPL:509043 } term and type variable bindings are
16
16
collected in a single context. We need two separate contexts, one for
@@ -24,13 +24,13 @@ \section{SytemF}
24
24
\end {lstlisting }
25
25
26
26
Context \code |TermBinding| is the term variable binding and associates
27
- identifier with types. \code |TypeBinding| binds type variables,
28
- because we have no notion of kinds in SystemF type variables are
29
- associated to nothing . In our implementation variable and type
30
- identifiers are build from the same set of identifiers.
27
+ identifier with types. \code |TypeBinding| binds type variables. Type
28
+ variables are associated to nothing because we have no notion of kinds
29
+ in SystemF . In our implementation variable and type identifiers are
30
+ build from the same set of identifiers.
31
31
32
32
The typing judgment has to reflect that we have two
33
- contexts. Therefore our typing judgment is defined as follows.
33
+ contexts. Therefore our typing judgment is defined as follows:
34
34
35
35
\ begin{lstlisting} [language=sltc]
36
36
judgments
@@ -79,7 +79,7 @@ \section{SytemF}
79
79
mechanism. However type substitution is implemented in the same
80
80
fashion like in a functional programming language with pattern
81
81
matching. Substitution is also implemented as a separate module and
82
- imported into the SystemF specification.
82
+ then imported into the SystemF specification.
83
83
84
84
\ begin{lstlisting} [language=sltc]
85
85
judgments
@@ -128,11 +128,13 @@ \section{Lambda-Calculus with Subtyping}
128
128
in~\cite {Pierce:2002:TPL:509043 }. The specification for this type
129
129
system is divided into two modules. One module specifies the type
130
130
system without subtyping and the other module extends the first module
131
- with subtyping. The implementation of the type system without differs
132
- in two aspects from the text book formalization. First, we have to
133
- implement the freshness condition explicitly, as in the previous
134
- section. Second, we have to model rules that talk about all elements
135
- of a record inductively. Formula~\ref {formula:record-typing } shows the
131
+ with subtyping. The implementation of the type system without
132
+ subtyping differs in two aspects from the text book
133
+ formalization. First, we have to implement the freshness condition
134
+ explicitly, as in the previous section. Second, we have to model rules
135
+ that talk about all elements of a record inductively.
136
+
137
+ Formula~\ref {formula:record-typing } shows the
136
138
formalization of the record typing rule
137
139
from~\cite {Pierce:2002:TPL:509043 }. This rule says that a record is
138
140
well-typed if all its elements are
@@ -147,7 +149,7 @@ \section{Lambda-Calculus with Subtyping}
147
149
\label {formula:record-typing }
148
150
\end {align }
149
151
150
- That quantification is not possible in our specification
152
+ This quantification is not possible in our specification
151
153
language. Therefore we model this condition inductively as shown in
152
154
the following.
153
155
@@ -169,10 +171,10 @@ \section{Lambda-Calculus with Subtyping}
169
171
Here we ensure with rule \code |step| that the first element is
170
172
well-typed and the record without the first element is well
171
173
typed. Rule \code |base| is the base case for this definition and
172
- assigns the empty record the empty type. Note that we support in
173
- contrast to~\cite {Pierce:2002:TPL:509043 } the empty record. We
174
+ assigns the empty record the empty record type. Note that we support
175
+ in contrast to~\cite {Pierce:2002:TPL:509043 } the empty record. We
174
176
included the empty record in our definition to demonstrate a top rule
175
- for records in the subtyping module. We have implement the membership
177
+ for records in the subtyping module. We have implemented the membership
176
178
test for the projection typing rule \code |T-proj| in a similar way.
177
179
178
180
The module implementing subtyping for this lambda calculus contains a
@@ -224,10 +226,10 @@ \section{Lambda-Calculus with Subtyping}
224
226
\end {lstlisting }
225
227
\end {minipage }
226
228
227
- The subtyping relations has further a rule that defines the empty
229
+ The subtyping relations have a further rule that defines the empty
228
230
record \code |{}| to be the top element of records, as well as rules
229
231
for with and depth subtyping and permutation of record elements. In
230
- conclusion we could specify a variant of the simply typed lambda
232
+ conclusion we can specify a variant of the simply typed lambda
231
233
calculus with an intuitive subtyping relation and reduce the
232
234
non-determinism in the type system.
233
235
0 commit comments