Skip to content
This repository was archived by the owner on Sep 1, 2020. It is now read-only.

Commit c3b6cfa

Browse files
committed
Merge pull request scala#4572 from soc/topic/spec-history
Spec: Add lost references, cleanup
2 parents 61fbcab + a74bdc7 commit c3b6cfa

File tree

2 files changed

+154
-132
lines changed

2 files changed

+154
-132
lines changed

spec/05-classes-and-objects.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -501,14 +501,13 @@ declaration in a template. Such members can be accessed only from
501501
within the directly enclosing template and its companion module or
502502
[companion class](#object-definitions).
503503

504-
The modifier can be _qualified_ with an identifier $C$ (e.g.
505-
`private[$C$]`) that must denote a class or package
506-
enclosing the definition. Members labeled with such a modifier are
507-
accessible respectively only from code inside the package $C$ or only
508-
from code inside the class $C$ and its
504+
A `private` modifier can be _qualified_ with an identifier $C$ (e.g.
505+
`private[$C$]`) that must denote a class or package enclosing the definition.
506+
Members labeled with such a modifier are accessible respectively only from code
507+
inside the package $C$ or only from code inside the class $C$ and its
509508
[companion module](#object-definitions).
510509

511-
An different form of qualification is `private[this]`. A member
510+
A different form of qualification is `private[this]`. A member
512511
$M$ marked with this modifier is called _object-protected_; it can be accessed only from within
513512
the object in which it is defined. That is, a selection $p.M$ is only
514513
legal if the prefix is `this` or `$O$.this`, for some
@@ -533,11 +532,10 @@ Protected members of a class can be accessed from within
533532
- all templates that have the defining class as a base class,
534533
- the companion module of any of those classes.
535534

536-
A `protected` modifier can be qualified with an
537-
identifier $C$ (e.g. `protected[$C$]`) that must denote a
538-
class or package enclosing the definition. Members labeled with such
539-
a modifier are also accessible respectively from all code inside the
540-
package $C$ or from all code inside the class $C$ and its
535+
A `protected` modifier can be qualified with an identifier $C$ (e.g.
536+
`protected[$C$]`) that must denote a class or package enclosing the definition.
537+
Members labeled with such a modifier are also accessible respectively from all
538+
code inside the package $C$ or from all code inside the class $C$ and its
541539
[companion module](#object-definitions).
542540

543541
A protected identifier $x$ may be used as a member name in a selection
@@ -744,7 +742,7 @@ which when applied to parameters conforming to types $\mathit{ps}$
744742
initializes instances of type `$c$[$\mathit{tps}\,$]` by evaluating the template
745743
$t$.
746744
747-
###### Example
745+
###### Example – `val` and `var` parameters
748746
The following example illustrates `val` and `var` parameters of a class `C`:
749747
750748
```scala
@@ -753,7 +751,7 @@ val c = new C(1, "abc", List())
753751
c.z = c.y :: c.z
754752
```
755753

756-
### Example Private Constructor
754+
###### Example Private Constructor
757755
The following class can be created only from its companion module.
758756

759757
```scala
@@ -835,7 +833,7 @@ This defines a class `LinkedList` with three constructors. The
835833
second constructor constructs an singleton list, while the
836834
third one constructs a list with a given head and tail.
837835

838-
## Case Classes
836+
### Case Classes
839837

840838
```ebnf
841839
TmplDef ::= `case' `class' ClassDef

0 commit comments

Comments
 (0)