Conversation
|
There is no suggested spec reviewer anymore. @SethTisue can you suggest someone (or maybe reviewing the two sentences is just as fast?) |
spec/05-classes-and-objects.md
Outdated
| ### `private` | ||
| The `private` modifier can be used with any definition or | ||
| declaration in a template. Such members can be accessed only from | ||
| The `private` modifier can be used with any template definition or any definition or |
There was a problem hiding this comment.
"any template" is not accurate, local definitions can't be private. Maybe also say "top-level" here?
scala> def f = { private class C; 0 }
^
error: illegal start of statement (no modifiers allowed here)
There was a problem hiding this comment.
Maybe split it up then?
The `private` modifier can be used with any definition or declaration in a
template. Private members of a template can be accessed only from within the
directly enclosing template and its companion module or
[companion class](#object-definitions).
The `private` modifier is also valid for
[top-level](09-top-level-definitions.html#packagings) templates. Private
top-level templates can be accessed only from within the same package.
There was a problem hiding this comment.
Yes I think that makes sense. I'd mark it as "Note" and only keep The `private` modifier is also valid for [top-level](09-top-level-definitions.html#packagings) templates instead of repeating it here.
4ee3ad9 to
fc82328
Compare
| [companion class](#object-definitions). | ||
|
|
||
| The `private` modifier is also valid for | ||
| [top-level](09-top-level-definitions.html#packagings) templates. |
There was a problem hiding this comment.
This doesn't say what the semantics are; I think you deleted it in an edit.
One might imagine a top-level private class C is private to object C instead of enclosing private[p].
There was a problem hiding this comment.
I suggested not to repeat the semantics here, as they are defined in the linked section.
There was a problem hiding this comment.
OK thanks for clarifying. I always forget to click the link. Please don't assume all your readers are so lazy.
private class Foowasn't specced anywhere.Aligned the spec here with the implementation, which seems sensible.