diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-03-26 01:11:09 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-03-26 01:11:09 -0700 |
commit | f16ab43734906e752eba81c3e73acb44dd792bbc (patch) | |
tree | d6d15198fa95fdab655c6a255b6c98db692b6285 | |
parent | 56295292f28c78ebb4421e965ec302264fe51976 (diff) | |
download | scala-f16ab43734906e752eba81c3e73acb44dd792bbc.tar.gz scala-f16ab43734906e752eba81c3e73acb44dd792bbc.tar.bz2 scala-f16ab43734906e752eba81c3e73acb44dd792bbc.zip |
use simple quotes, fix indent, escape dollar
-rw-r--r-- | 04-identifiers-names-and-scopes.md | 2 | ||||
-rw-r--r-- | 05-types.md | 71 | ||||
-rw-r--r-- | 08-expressions.md | 21 | ||||
-rw-r--r-- | 10-pattern-matching.md | 4 | ||||
-rw-r--r-- | 15-syntax-summary.md | 2 |
5 files changed, 48 insertions, 52 deletions
diff --git a/04-identifiers-names-and-scopes.md b/04-identifiers-names-and-scopes.md index 62d150d281..a9985d1340 100644 --- a/04-identifiers-names-and-scopes.md +++ b/04-identifiers-names-and-scopes.md @@ -107,7 +107,7 @@ object A { { val x = "abc" // `x' bound by local definition import P.X._ // `x' and `y' bound by wildcard import // println("L19: "+y) // reference to `y' is ambiguous here - println("L20: "+x) // `x' refers to string ``abc'' here + println("L20: "+x) // `x' refers to string "abc" here }}}}}} ``` diff --git a/05-types.md b/05-types.md index 1049813f2e..b54e9b983b 100644 --- a/05-types.md +++ b/05-types.md @@ -711,40 +711,39 @@ These notions are defined mutually recursively as follows. 1. The set of _base types_ of a type is a set of class types, given as follows. - - - The base types of a class type $C$ with parents $T_1 , \ldots , T_n$ are - $C$ itself, as well as the base types of the compound type - `$T_1$ with … with $T_n$ { $R$ }`. - - The base types of an aliased type are the base types of its alias. - - The base types of an abstract type are the base types of its upper bound. - - The base types of a parameterized type - `$C$[$T_1 , \ldots , T_n$]` are the base types - of type $C$, where every occurrence of a type parameter $a_i$ - of $C$ has been replaced by the corresponding parameter type $T_i$. - - The base types of a singleton type `$p$.type` are the base types of - the type of $p$. - - The base types of a compound type - `$T_1$ with $\ldots$ with $T_n$ { $R$ }` - are the _reduced union_ of the base - classes of all $T_i$'s. This means: - Let the multi-set $\mathscr{S}$ be the multi-set-union of the - base types of all $T_i$'s. - If $\mathscr{S}$ contains several type instances of the same class, say - `$S^i$#$C$[$T^i_1 , \ldots , T^i_n$]` $(i \in I)$, then - all those instances - are replaced by one of them which conforms to all - others. It is an error if no such instance exists. It follows that the - reduced union, if it exists, - produces a set of class types, where different types are instances of - different classes. - - The base types of a type selection `$S$#$T$` are - determined as follows. If $T$ is an alias or abstract type, the - previous clauses apply. Otherwise, $T$ must be a (possibly - parameterized) class type, which is defined in some class $B$. Then - the base types of `$S$#$T$` are the base types of $T$ - in $B$ seen from the prefix type $S$. - - The base types of an existential type `$T$ forSome { $Q$ }` are - all types `$S$ forSome { $Q$ }` where $S$ is a base type of $T$. + - The base types of a class type $C$ with parents $T_1 , \ldots , T_n$ are + $C$ itself, as well as the base types of the compound type + `$T_1$ with … with $T_n$ { $R$ }`. + - The base types of an aliased type are the base types of its alias. + - The base types of an abstract type are the base types of its upper bound. + - The base types of a parameterized type + `$C$[$T_1 , \ldots , T_n$]` are the base types + of type $C$, where every occurrence of a type parameter $a_i$ + of $C$ has been replaced by the corresponding parameter type $T_i$. + - The base types of a singleton type `$p$.type` are the base types of + the type of $p$. + - The base types of a compound type + `$T_1$ with $\ldots$ with $T_n$ { $R$ }` + are the _reduced union_ of the base + classes of all $T_i$'s. This means: + Let the multi-set $\mathscr{S}$ be the multi-set-union of the + base types of all $T_i$'s. + If $\mathscr{S}$ contains several type instances of the same class, say + `$S^i$#$C$[$T^i_1 , \ldots , T^i_n$]` $(i \in I)$, then + all those instances + are replaced by one of them which conforms to all + others. It is an error if no such instance exists. It follows that the + reduced union, if it exists, + produces a set of class types, where different types are instances of + different classes. + - The base types of a type selection `$S$#$T$` are + determined as follows. If $T$ is an alias or abstract type, the + previous clauses apply. Otherwise, $T$ must be a (possibly + parameterized) class type, which is defined in some class $B$. Then + the base types of `$S$#$T$` are the base types of $T$ + in $B$ seen from the prefix type $S$. + - The base types of an existential type `$T$ forSome { $Q$ }` are + all types `$S$ forSome { $Q$ }` where $S$ is a base type of $T$. 1. The notion of a type $T$ _in class $C$ seen from some prefix type $S$_ makes sense only if the prefix type $S$ @@ -776,8 +775,8 @@ These notions are defined mutually recursively as follows. If $T$ is a possibly parameterized class type, where $T$'s class is defined in some other class $D$, and $S$ is some prefix type, - then we use ``$T$ seen from $S$'' as a shorthand for - ``$T$ in $D$ seen from $S$''. + then we use "$T$ seen from $S$" as a shorthand for + "$T$ in $D$ seen from $S$". 1. The _member bindings_ of a type $T$ are (1) all bindings $d$ such that there exists a type instance of some class $C$ among the base types of $T$ diff --git a/08-expressions.md b/08-expressions.md index 1257eb3bfc..4f3d6a4636 100644 --- a/08-expressions.md +++ b/08-expressions.md @@ -51,12 +51,9 @@ discussed subsequently in decreasing order of precedence. ## Expression Typing -The typing of expressions is often relative to some _expected type_ -(which might be undefined). -When we write ``expression $e$ is expected to conform to -type $T$'', we mean: (1) the expected type of $e$ is -$T$, and (2) the type of expression $e$ must conform to -$T$. +The typing of expressions is often relative to some _expected type_ (which might be undefined). When we write "expression $e$ is expected to conform to type $T$", we mean: + 1. the expected type of $e$ is $T$, and + 2. the type of expression $e$ must conform to $T$. The following skolemization rule is applied universally for every expression: If the type of an expression would be an existential type @@ -91,14 +88,14 @@ which refers to a special “`null`” object. This object implements methods in class `scala.AnyRef` as follows: - `eq($x\,$)` and `==($x\,$)` return `true` iff the - argument $x$ is also the ``null'' object. + argument $x$ is also the "null" object. - `ne($x\,$)` and `!=($x\,$)` return true iff the - argument x is not also the ``null'' object. + argument x is not also the "null" object. - `isInstanceOf[$T\,$]` always returns `false`. - `asInstanceOf[$T\,$]` returns the [default value](06-basic-declarations-and-definitions.html#value-declarations-and-definitions) of type $T$. - `##` returns ``0``. -A reference to any other member of the ``null'' object causes a +A reference to any other member of the "null" object causes a `NullPointerException` to be thrown. @@ -1309,7 +1306,7 @@ syntax. Each of these is equivalent to the anonymous function on its right. ## Constant Expressions Constant expressions are expressions that the Scala compiler can evaluate to a constant. -The definition of ``constant expression'' depends on the platform, but they +The definition of "constant expression" depends on the platform, but they include at least the expressions of the following forms: - A literal of a value class, such as an integer @@ -1484,8 +1481,8 @@ single applicable alternative, that alternative is chosen. Otherwise, let $\math be the set of applicable alternatives which don't employ any default argument in the application to $e_1 , \ldots , e_m$. It is again an error if $\mathscr{CC}$ is empty. Otherwise, one chooses the _most specific_ alternative among the alternatives -in $\mathscr{CC}$, according to the following definition of being ``as specific as'', and -``more specific than'': +in $\mathscr{CC}$, according to the following definition of being "as specific as", and +"more specific than": <!-- question: given diff --git a/10-pattern-matching.md b/10-pattern-matching.md index 1271b85e83..042873e05b 100644 --- a/10-pattern-matching.md +++ b/10-pattern-matching.md @@ -359,7 +359,7 @@ A type pattern $T$ is of one of the following forms: Types which are not of one of the forms described above are also accepted as type patterns. However, such type patterns will be translated to their [erasure](05-types.html#type-erasure). The Scala -compiler will issue an ``unchecked'' warning for these patterns to +compiler will issue an "unchecked" warning for these patterns to flag the possible loss of type-safety. A _type variable pattern_ is a simple identifier which starts with @@ -492,7 +492,7 @@ top-level runtime-class of the value `x` conforms to might lead to a class cast exception later on, in the case where the list `x` contains elements other than strings. The Scala compiler will flag this potential loss of type-safety with an -``unchecked'' warning message. +"unchecked" warning message. ###### Example diff --git a/15-syntax-summary.md b/15-syntax-summary.md index 2dd9470b23..2aa4e94778 100644 --- a/15-syntax-summary.md +++ b/15-syntax-summary.md @@ -18,7 +18,7 @@ The lexical syntax of Scala is given by the following grammar in EBNF form: ``` whiteSpace ::= ‘\u0020’ | ‘\u0009’ | ‘\u000D’ | ‘\u000A’ -upper ::= ‘A’ | … | ‘Z’ | ‘$’ | ‘_’ // and Unicode category Lu +upper ::= ‘A’ | … | ‘Z’ | ‘\$’ | ‘_’ // and Unicode category Lu lower ::= ‘a’ | … | ‘z’ // and Unicode category Ll letter ::= upper | lower // and Unicode categories Lo, Lt, Nl digit ::= ‘0’ | … | ‘9’ |