summaryrefslogtreecommitdiff
path: root/06-basic-declarations-and-definitions.md
diff options
context:
space:
mode:
authorSimon Ochsenreither <simon@ochsenreither.de>2013-02-21 03:54:08 +0100
committerIain McGinniss <iainmcgin@gmail.com>2013-02-21 10:08:05 +0000
commit50ce3228b80475d1a0d748ec40ef532afb96df8f (patch)
tree94f28c3aee44315bca931ac12ebdadfa6ba922ef /06-basic-declarations-and-definitions.md
parent2311e3498bea8d149cc38a6d3585de245134add9 (diff)
downloadscala-50ce3228b80475d1a0d748ec40ef532afb96df8f.tar.gz
scala-50ce3228b80475d1a0d748ec40ef532afb96df8f.tar.bz2
scala-50ce3228b80475d1a0d748ec40ef532afb96df8f.zip
Miscellaneous cleanups:
- Value of Unit is (), not {} - Fix desugared pattern matching code - Mention object-protected values - Use uppercase type variables for Tuple/Function code - Replace Application with App
Diffstat (limited to '06-basic-declarations-and-definitions.md')
-rw-r--r--06-basic-declarations-and-definitions.md12
1 files changed, 6 insertions, 6 deletions
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