summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--05-types.md4
-rw-r--r--06-basic-declarations-and-definitions.md12
-rw-r--r--07-classes-and-objects.md2
-rw-r--r--11-top-level-definitions.md15
-rw-r--r--14-the-scala-standard-library.md6
5 files changed, 20 insertions, 19 deletions
diff --git a/05-types.md b/05-types.md
index 3f9ca809f5..1d6fe8579f 100644
--- a/05-types.md
+++ b/05-types.md
@@ -232,10 +232,10 @@ implement other traits).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
case class Tuple$n$[+T1, … , +$T_n$](_1: T1, … , _n: $T_n$)
-extends Product_n[T1, … , $T_n$] {}
+extends Product_n[T1, … , $T_n$]
trait Product_n[+T1, … , +$T_n$] {
- override def arity = $n$
+ override def productArity = $n$
def _1: T1
def _n: $T_n$
diff --git a/06-basic-declarations-and-definitions.md b/06-basic-declarations-and-definitions.md
index 1774e10353..8f3c22ca0c 100644
--- a/06-basic-declarations-and-definitions.md
+++ b/06-basic-declarations-and-definitions.md
@@ -83,7 +83,7 @@ value definition `val $p$ = $e$` is expanded as follows:
1. If the pattern $p$ has bound variables $x_1 , \ldots , x_n$, where $n > 1$:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
-val $\$ x$ = $e$ match {case $p$ => {$x_1 , \ldots , x_n$}}
+val $\$ x$ = $e$ match {case $p$ => ($x_1 , \ldots , x_n$)}
val $x_1$ = $\$ x$._1
$\ldots$
val $x_n$ = $\$ x$._n .
@@ -117,7 +117,7 @@ $e$ match { case $p$ => ()}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
val x = f() match { case Some(x) => x }
- val x$\$$ = mylist match { case x :: xs => {x, xs} }
+ val x$\$$ = mylist match { case x :: xs => (x, xs) }
val x = x$\$$._1
val xs = x$\$$._2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -184,7 +184,7 @@ type $T$ as follows:
`0.0f` if $T$ is `Float`
`0.0d` if $T$ is `Double`
`false` if $T$ is `Boolean`
-`{}` if $T$ is `Unit`
+`()` if $T$ is `Unit`
`null` for all other types $T$
---------- --------------------------------------------------
@@ -444,7 +444,7 @@ changes at the following constructs.
<!-- TODO: handle type aliases -->
References to the type parameters in
-[object-private values, variables, or methods](#modifiers) of the class are not
+[object-private or object-protected values, variables, or methods](#modifiers) of the class are not
checked for their variance position. In these members the type parameter may
appear anywhere without restricting its legal variance annotations.
@@ -708,10 +708,10 @@ FunDef ::= FunSig [nl] ‘{’ Block ‘}’
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Special syntax exists for procedures, i.e.\ functions that return the
-\verb@Unit@ value \verb@{}@.
+`Unit` value `()`.
A procedure declaration is a function declaration where the result type
is omitted. The result type is then implicitly completed to the
-\verb@Unit@ type. E.g., `def $f$($\mathit{ps}$)` is equivalent to
+`Unit` type. E.g., `def $f$($\mathit{ps}$)` is equivalent to
`def $f$($\mathit{ps}$): Unit`.
A procedure definition is a function definition where the result type
diff --git a/07-classes-and-objects.md b/07-classes-and-objects.md
index 1be54809a8..4bf7e55107 100644
--- a/07-classes-and-objects.md
+++ b/07-classes-and-objects.md
@@ -524,7 +524,7 @@ the validity and meaning of a modifier are as follows.
from templates inside $C$.
An different form of qualification is `private[this]`. A member
- $M$ marked with this modifier can be accessed only from within
+ $M$ marked with this modifier is called {\em object-protected}; it can be accessed only from within
the object in which it is defined. That is, a selection $p.M$ is only
legal if the prefix is `this` or `$O$.this`, for some
class $O$ enclosing the reference. In addition, the restrictions for
diff --git a/11-top-level-definitions.md b/11-top-level-definitions.md
index 02c7db7bb9..fee07fb0fc 100644
--- a/11-top-level-definitions.md
+++ b/11-top-level-definitions.md
@@ -155,8 +155,8 @@ passed to the `main` method as a parameter of type
`Array[String]`.
The `main` method of a program can be directly defined in the
-object, or it can be inherited. The scala library defines a class
-`scala.Application` that defines an empty inherited `main` method.
+object, or it can be inherited. The scala library defines a special class
+`scala.App` whose body acts as a `main` method.
An objects $m$ inheriting from this class is thus a program,
which executes the initializaton code of the object $m$.
@@ -165,12 +165,13 @@ which executes the initializaton code of the object $m$.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
package test
- object HelloWord {
- def main(args: Array[String]) { println("hello world") }
+ object HelloWorld {
+ def main(args: Array[String]) { println("Hello World") }
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This program can be started by the command
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scala test.HelloWorld
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -184,12 +185,12 @@ which executes the initializaton code of the object $m$.
would work as well.
`HelloWorld` can also be defined without a `main` method
- by inheriting from `Application` instead:
+ by inheriting from `App` instead:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
package test
- object HelloWord extends Application {
- println("hello world")
+ object HelloWorld extends App {
+ println("Hello World")
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/14-the-scala-standard-library.md b/14-the-scala-standard-library.md
index da3d1f75ab..d03dc53efc 100644
--- a/14-the-scala-standard-library.md
+++ b/14-the-scala-standard-library.md
@@ -365,7 +365,7 @@ These are defined as follows.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
package scala
-case class Tuple$n$[+a_1, ..., +a_n](_1: a_1, ..., _$n$: a_$n$) {
+case class Tuple$n$[+A_1, ..., +A_n](_1: A_1, ..., _$n$: A_$n$) {
def toString = "(" ++ _1 ++ "," ++ $\ldots$ ++ "," ++ _$n$ ++ ")"
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -381,8 +381,8 @@ These are defined as follows.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.scala}
package scala
-trait Function$n$[-a_1, ..., -a_$n$, +b] {
- def apply(x_1: a_1, ..., x_$n$: a_$n$): b
+trait Function$n$[-A_1, ..., -A_$n$, +B] {
+ def apply(x_1: A_1, ..., x_$n$: A_$n$): B
def toString = "<function>"
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~