File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments