@@ -20,7 +20,7 @@ there are so many of them around.
20
20
SPLASH is a set of conferences running together (OOPSLA being one of
21
21
the main ones), so you get exposed to a variety of topics and get to
22
22
talk to people from many different areas. One talk that stood out for
23
- me was Simon Peyton Jones speaking about how they reform the UK
23
+ me was Simon Peyton Jones speaking about how they are reforming the UK
24
24
curriculum to teach computational thinking to kids from primary school
25
25
on. It's been Simon's main "other" occupation besides Haskell and he
26
26
gave a fascinating talk that conveyed his great enthusiasm for the
@@ -29,21 +29,21 @@ was that we have to act now, when things are waiting to be defined. A
29
29
quote: "We know we have failed if, 10 years from now, the outcome is
30
30
just that every kid can code Java".
31
31
32
- At the Scala Symposium I was talking about how we implemented
32
+ At the Scala Symposium I spoke about how we implemented
33
33
higher-kinded types in Dotty. This was a long and often painful
34
- journey. We tried overall four different approaches. Each of them was
34
+ journey. In total we tried four different approaches. Each of them was
35
35
an effort of many weeks -- sometimes several months -- to implement
36
36
the new scheme, debug it, and then finally discard it because we found
37
- out it was too hard to get right, or did not live up otherwise to
37
+ out it was too hard to get right, or did not otherwise live up to
38
38
expectations.
39
39
40
40
The original reason for trying so many different avenues had to do
41
41
with DOT, which is intended to be the foundation of future Scala. DOT
42
- as is has no provision for higher-kinded types, but it turns out
42
+ as- is has no provision for higher-kinded types, but it turns out
43
43
that a restricted version of higher-kinded types can be
44
44
straightforwardly encoded in it. That issue is not just academic
45
45
because the _ dotty_ compiler uses DOT's constructs as its core data
46
- structures. So what is hard to do in DOT tends to hard to implement in
46
+ structures. So what is hard to do in DOT tends to be hard to implement in
47
47
the compiler as well.
48
48
49
49
Originally, we played with the idea to restrict higher-kinded types to
@@ -53,18 +53,17 @@ forced us to restrict the Scala language. More advanced idioms, such
53
53
as type classes for ` Monad ` and ` Functor ` would have required rewrites
54
54
and would not be as convenient to use. The boundary between what was
55
55
expressible and what was illegal was also not very intuitive. For instance,
56
- one could define an abstract polymorphic subtype of ` Maps ` in the usual way:
57
-
56
+ one could define an abstract polymorphic subtype of ` Map ` s in the usual way:
58
57
59
58
type M[K, V] <: Map[K, V]
60
59
61
- But one would could not define a type where the parameters were reversed. I.e.
60
+ But one could not define a type where the parameters were reversed. I.e.
62
61
63
62
type M[V, K] <: Map[K, V]
64
63
65
64
would have been illegal.
66
65
67
- To address these limitations, we played then with two more complicated
66
+ To address these limitations, we then played with two more complicated
68
67
encodings of higher-kinded types in _ dotty_ 's core types. Neither of
69
68
these worked out very well so in the end we settled for the "brute
70
69
force" approach of adding higher-kinded types without trying to re-use
@@ -83,5 +82,3 @@ works out it would be a case where compiler hacking influenced the way
83
82
we do theory. It's usually more efficient to do theory first and
84
83
implement it systematically once it's done, but sometimes going from
85
84
practice to theory is the only route available.
86
-
87
-
0 commit comments