|
2 | 2 | layout: blog
|
3 | 3 | post-type: blog
|
4 | 4 | by: Martin Odersky
|
5 |
| -title: Scaling DOT to Scala: Soundness |
| 5 | +title: Scaling DOT to Scala - Soundness |
6 | 6 | disqus: true
|
7 | 7 | ---
|
8 | 8 |
|
9 | 9 | In my [last
|
10 | 10 | blog](http://www.scala-lang.org/blog/2016/02/03/essence-of-scala.html)
|
11 | 11 | I introduced DOT, a minimal calculus that underlies much of Scala.
|
12 | 12 | DOT is much more than an academic exercise, because it gives us
|
13 |
| -guidelines how to design a sound type system for full Scala. As was |
14 |
| -argued in the previous blog post, the danger a path-dependent type |
| 13 | +guidelines how to design a sound type system for full Scala. |
| 14 | + |
| 15 | +## Recap: The Problem of Bad Bounds |
| 16 | + |
| 17 | +As was argued in the previous blog post, the danger a path-dependent type |
15 | 18 | system like Scala's faces is inconsistent bounds or aliases. For
|
16 | 19 | instance, you might have a type alias
|
17 | 20 |
|
@@ -39,6 +42,8 @@ that check is easy: When objects are created, we know their class and
|
39 | 42 | we can insist that all nested types in that class are aliases or
|
40 | 43 | have consistent bounds. So far so good.
|
41 | 44 |
|
| 45 | +## Loopholes Caused by Scaling Up |
| 46 | + |
42 | 47 | But if we want to scale up the DOT result for full Scala, several
|
43 | 48 | loopholes open up. These come all down to the fact that the prefix of
|
44 | 49 | a type selection might _not_ be a value that's constructed with a
|
@@ -86,6 +91,8 @@ any type you choose. Such a feat is an impossible promise, of
|
86 | 91 | course. The promise is usually broken at run-time by failing with a
|
87 | 92 | `ClassCastException`.
|
88 | 93 |
|
| 94 | +## Plugging the Loopholes |
| 95 | + |
89 | 96 | To get back to soundness we need to plug the loopholes. Some of the
|
90 | 97 | necessary measures are taken in pull request [#1051](https://github.com/lampepfl/dotty/issues/1051).
|
91 | 98 | That pull request
|
|
0 commit comments