Skip to content

Commit 9872294

Browse files
authored
Update reference-package-objects.md
1 parent 3cf958b commit 9872294

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

content/reference-package-objects.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,18 @@ syntax and less standardization.
180180

181181
## Limitations
182182

183-
* `a.b` only expands to `a.b.package` when used "standalone", i.e. not when part of a
184-
larger select chain `a.b.c` or equivalent postfix expression `a.b c`, prefix
185-
expression `!a.b`, or infix expression `a.b c d`.
183+
* With this proposal, `a.b.c` can be refactored to `val x = a.b; x.c` only when `c` is declared inside
184+
the `a.b` package object. This is slightly more irregular than the status quo, which disallows such
185+
a refactoring at any time. In general, a package with a package object no longer behaves the same
186+
as a package without.
186187

187-
* `a.b` expands to `a.b.package` of the type `a.b.package.type`, and only contains the
188-
contents of the `package object`. It does not contain other things in the
189-
`package a.b` that are outside of the `package object`
188+
## Open Questions
190189

191-
Both these requirements are necessary for backwards compatibility, and anyway do not impact
192-
the main goal of removing the irregularity between `package object`s and normal `object`s
193-
and providing some non-hacky way to refer to the `package object` values
190+
There are some open questions that can be resolved during experimentation
194191

192+
* Should package objects be usable as singleton type prefixes, e.g. `type foo == scala.type`?
193+
* Should package objects participate in `foo() -> foo.apply()` desugaring, e.g. `_root_.pprint(124)`?
194+
*
195195

196196
## Implementation & Testing
197197

@@ -250,4 +250,4 @@ index b820dff8c3..29ba15bcdd 100644
250250
}
251251

252252
override def multiType: Array[TypeResult] = {
253-
```
253+
```

0 commit comments

Comments
 (0)