Skip to content

Commit 2cd9ab6

Browse files
committed
Add section on dropping DelayedInit
1 parent d207e7e commit 2cd9ab6

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

docs/docs/reference/delaydInit.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
layout: doc-page
3+
title: Dropped: Delayedinit
4+
---
5+
6+
The special handling of the `DelayedInit` trait is no longer
7+
supported.
8+
9+
One consequence is that the `App` class, which used `DelayedInit` is
10+
now partially broken. You can still use `App` for an easy and concise
11+
way to set up a main program. Example:
12+
13+
object HelloWorld extends App {
14+
println("Hello, world!")
15+
}
16+
17+
However, the code is now run in the initializer of the object, which on
18+
some JVM's means that it will only be interpreted. So, better not use it
19+
for benchmarking! Also, if you want to access the command line arguments,
20+
you need to use an explicit `main` method for that.
21+
22+
object Hello extends App {
23+
def main(args: Array[String]) =
24+
println(s"Hello, ${args(0)}")
25+
}
26+

docs/sidebar.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ sidebar:
33
url: blog/index.html
44
- title: Reference
55
subsection:
6+
- title: Dropped Features
7+
subsection:
8+
- title: DelayedInit
9+
- url: docs/reference/delayed-init.md
610
- title: Implicit Function Types
711
url: docs/reference/implicit-function-types.md
812
- title: Intersection types

0 commit comments

Comments
 (0)