You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blog/_posts/2016-02-03-essence-of-scala.md
+10-8Lines changed: 10 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,10 @@ it's DOT, the calculus of dependent object types, that underlies Scala.
13
13
A [paper on DOT](http://infoscience.epfl.ch/record/215280) will be
14
14
presented in April at [Wadlerfest](http://events.inf.ed.ac.uk/wf2016),
15
15
an event celebrating Phil Wadler's 60th birthday. There's also a prior
16
-
[technical report](http://arxiv.org/abs/1510.05216v1) by Tiark Rompf
17
-
and Nada Amin describing a slightly different version of the
18
-
calculus. Each version describes a proof of type soundness that has
19
-
been machine-checked for correctness.
16
+
technical report (["From F to DOT"](http://arxiv.org/abs/1510.05216))
17
+
by Tiark Rompf and Nada Amin describing a slightly different version
18
+
of the calculus. Each paper describes a proof of type soundness that
19
+
has been machine-checked for correctness.
20
20
21
21
## The DOT calculus
22
22
@@ -64,24 +64,26 @@ form](https://en.wikipedia.org/wiki/A-normal_form), that is, every
64
64
intermediate term is abstracted out in a local definition.
65
65
66
66
The following _type soundness_ property was shown in each case with a
67
-
mechanized proof:
67
+
mechanized, (i.e. machine-checked) proof:
68
68
69
69
> If a term `t` has type `T`, and the evaluation of `t` terminates, then
70
70
the result of the evaluation will be a value `v` of type `T`.
71
71
72
72
## Difficulties
73
73
74
74
Formulating the precise soundness theorem and proving it was unexpectedly hard,
75
-
because it uncovered a problem complex that had not been
75
+
because it uncovered some technical challenges that had not been
76
76
studied in depth before. In DOT - as well as in many programming languages -
77
77
you can have conflicting definitions. For instance you might have an abstract
78
78
type declaration in a base class with two conflicting aliases in subclasses:
79
79
80
80
trait Base { type A }
81
81
trait Sub1 extends Base { type A = String }
82
82
trait Sub2 extends Base { type A = Int }
83
+
trait Bad extends Sub1 with Sub2
83
84
84
-
Now, if you combine `Sub1` and `Sub2` in one class, you get a conflict, since the type `A` is supposed to be equal to both `String` and `Int`. If you do
85
+
Now, if you combine `Sub1` and `Sub2` in trait `Bad` you get a conflict,
86
+
since the type `A` is supposed to be equal to both `String` and `Int`. If you do
85
87
not detect the conflict and assume the equalities at face value you
86
88
get `String = A = Int`, hence by transitivity `String = Int`! Once you
87
89
are that far, you can of course engineer all sorts of situations where
@@ -149,5 +151,5 @@ project are important.
149
151
This lets us put other constructs of the Scala language to the test,
150
152
either to increase our confidence that they are indeed sound, or
151
153
to show that they are unsound. In my next blog I will
152
-
present some of the issues we have discovered by that exercise.
154
+
present some of the issues we have discovered by that exercise.
0 commit comments