Skip to content

Commit 8ced7cc

Browse files
committed
Update docs
1 parent 86b88cc commit 8ced7cc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docs/docs/reference/dropped-features/package-objects.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: doc-page
3-
title: Dropped: Package Objects
3+
title: "Instance Definitions"
44
---
55

66
Package objects
@@ -34,3 +34,9 @@ The compiler generates synthetic objects that wrap toplevel definitions falling
3434
- companion objects of opaque types.
3535

3636
If a source file `src.scala` contains such toplevel definitions, they will be put in a synthetic object named `src$package`. The wrapping is transparent, however. The definitions in `src` can still be accessed as members of the enclosing package.
37+
38+
**Note 1:** This means that the name of a source file containing wrapped toplevel definitions is relevant for binary compatibility. If the name changes, so does the name of the generated object and its class.
39+
40+
**Note 2:** A toplevel main method `def main(args: Array[String]): Unit = ...` is wrapped as any other method. If it appears
41+
in a source file `src.scala`, it could be invoked from the command line using a command like `scala src$package`. Since the
42+
"program name" is mangled it is recommended to always put `main` methods in explicitly named objects.

0 commit comments

Comments
 (0)