Skip to content

Commit dc25019

Browse files
committed
Top level elaboration
1 parent a40d1aa commit dc25019

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

docs/blog/_posts/2019-03-01-13th-dotty-milestone-release.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,26 @@ implied for Conversion[String, Token] {
275275
}
276276
```
277277

278-
It is worth mentioning that we now allow arbitrary definitions at the top level.
279-
This means package objects are now redundant, and will be phased out.
280-
You can read about [dropping package objects](https://dotty.epfl.ch/docs/reference/dropped-features/package-objects.html)
278+
_Top level_ definitions are now supported. This means that package objects are
279+
now redundant, and will be phased out. This means that all kinds of definitions
280+
can be written at the top level.
281+
282+
```scala
283+
package p.
284+
285+
type Labelled[T] = (String, T)
286+
val a: Labelled[Int] = ("count", 1)
287+
def b = a._2
288+
289+
case class C()
290+
291+
implicit object Cops {
292+
def (x: C) pair (y: C) = (x, y)
293+
}
294+
```
295+
296+
You can read about [dropping package
297+
objects](https://dotty.epfl.ch/docs/reference/dropped-features/package-objects.html)
281298
at the documentation linked or at the relevant PR
282299
[#5754](https://github.com/lampepfl/dotty/pull/5754).
283300

0 commit comments

Comments
 (0)