diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-03-10 16:58:12 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-03-10 16:58:12 -0700 |
commit | b44c5980ac2f1e330acd522badabb01f5eb50c06 (patch) | |
tree | d8a128c8ce8a46c46d2b468e6b51b33113a971b4 /04-identifiers-names-and-scopes.md | |
parent | 9dec37b50be3288822b9c7c0cb5c4d263f3d05e7 (diff) | |
download | scala-b44c5980ac2f1e330acd522badabb01f5eb50c06.tar.gz scala-b44c5980ac2f1e330acd522badabb01f5eb50c06.tar.bz2 scala-b44c5980ac2f1e330acd522badabb01f5eb50c06.zip |
github markdown: code blocks
Diffstat (limited to '04-identifiers-names-and-scopes.md')
-rw-r--r-- | 04-identifiers-names-and-scopes.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/04-identifiers-names-and-scopes.md b/04-identifiers-names-and-scopes.md index e4b92d2a8b..a102043691 100644 --- a/04-identifiers-names-and-scopes.md +++ b/04-identifiers-names-and-scopes.md @@ -31,11 +31,11 @@ scopes. Note that shadowing is only a partial order. In a situation like -~~~~~~~~~~~~~~ +``` val x = 1; { import p.x; x } -~~~~~~~~~~~~~~ +``` neither binding of `x` shadows the other. Consequently, the reference to `x` in the third line above would be ambiguous. @@ -57,7 +57,7 @@ of the referenced entity. (@) Assume the following two definitions of a objects named `X` in packages `P` and `Q`. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ``` package P { object X { val x = 1; val y = 2 } } @@ -65,12 +65,12 @@ of the referenced entity. package Q { object X { val x = true; val y = "" } } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ``` The following program illustrates different kinds of bindings and precedences between them. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ``` package P { // `X' bound by package clause import Console._ // `println' bound by wildcard import object A { @@ -92,7 +92,7 @@ of the referenced entity. // println("L19: "+y) // reference to `y' is ambiguous here println("L20: "+x) // `x' refers to string ``abc'' here }}}}}} - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ``` A reference to a qualified (type- or term-) identifier $e.x$ refers to the member of the type $T$ of $e$ which has the name $x$ in the same |