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: docs/blog/_posts/2018-03-05-seventh-dotty-milestone-release.md
+27-18
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,7 @@ Let's consider how `Option` can be represented as an enum. Previously using an e
39
39
enumclassOption[+T] {
40
40
defisDefined:Boolean
41
41
}
42
+
42
43
objectOption {
43
44
caseSome[+T](x: T) {
44
45
defisDefined=true
@@ -68,32 +69,40 @@ object Option {
68
69
}
69
70
```
70
71
71
-
You can visit our website for more information about [enumerations](/docs/reference/enums/enums.html)
72
-
and how we can use them to model [Algebraic Data Types](/docs/reference/enums/adts.html).
73
72
74
-
### Ghost terms [#3342](https://github.com/lampepfl/dotty/pull/3342) and removing phantom types [#3410](https://github.com/lampepfl/dotty/pull/3410)
75
-
The keyword `ghost` can be placed on parameters, `val` and `def` to enforce that no reference to
76
-
those terms is ever used (recursively). As they are never used, they can safely be removed during compilation.
77
-
Ghost terms replace _phantom types_: they have similar semantics, but with the added advantage that any type can be a ghost parameter. They can be used to add implicit type constraints that are only relevant at compilation time.
73
+
For more information about [Enumerations](/docs/reference/enums/enums.html) and how to use them to
74
+
model [Algebraic Data Types](/docs/reference/enums/adts.html), visit the respective sections in our
75
+
documentation.
78
76
79
-
```scala
80
-
// A function that requires an implicit evidence of type X =:= Y but never uses it.
81
-
// The parameter will be removed and the argument will not be evaluated.
82
-
defapply(implicit ghost ev: X=:=Y) =
83
-
foo(ev) // `ev` can be an argument to foo as foo will also never use it
0 commit comments