diff options
-rw-r--r-- | 03-lexical-syntax.md | 30 | ||||
-rw-r--r-- | 04-identifiers-names-and-scopes.md | 8 | ||||
-rw-r--r-- | 05-types.md | 32 | ||||
-rw-r--r-- | 08-expressions.md | 16 | ||||
-rw-r--r-- | 09-implicit-parameters-and-views.md | 22 | ||||
-rw-r--r-- | 10-pattern-matching.md | 16 | ||||
-rw-r--r-- | 14-the-scala-standard-library.md | 6 | ||||
-rw-r--r-- | README.md | 6 |
8 files changed, 68 insertions, 68 deletions
diff --git a/03-lexical-syntax.md b/03-lexical-syntax.md index 57bc1459e8..6230bea8b3 100644 --- a/03-lexical-syntax.md +++ b/03-lexical-syntax.md @@ -20,15 +20,15 @@ hexDigit ::= ‘0’ | … | ‘9’ | ‘A’ | … | ‘F’ | ‘a’ | To construct tokens, characters are distinguished according to the following classes (Unicode general category given in parentheses): -#. Whitespace characters. `\u0020 | \u0009 | \u000D | \u000A`{.grammar} -#. Letters, which include lower case letters(Ll), upper case letters(Lu), +1. Whitespace characters. `\u0020 | \u0009 | \u000D | \u000A` +1. Letters, which include lower case letters(Ll), upper case letters(Lu), titlecase letters(Lt), other letters(Lo), letter numerals(Nl) and the two characters \\u0024 ‘\\$’ and \\u005F ‘_’, which both count as upper case letters -#. Digits ` ‘0’ | … | ‘9’ `{.grammar} -#. Parentheses ` ‘(’ | ‘)’ | ‘[’ | ‘]’ | ‘{’ | ‘}’ `{.grammar} -#. Delimiter characters `` ‘`’ | ‘'’ | ‘"’ | ‘.’ | ‘;’ | ‘,’ ``{.grammar} -#. Operator characters. These consist of all printable ASCII characters +1. Digits `‘0’ | … | ‘9’` +1. Parentheses `‘(’ | ‘)’ | ‘[’ | ‘]’ | ‘{’ | ‘}’ ` +1. Delimiter characters ``‘`’ | ‘'’ | ‘"’ | ‘.’ | ‘;’ | ‘,’ `` +1. Operator characters. These consist of all printable ASCII characters \\u0020-\\u007F which are in none of the sets above, mathematical symbols(Sm) and other symbols(So). @@ -119,9 +119,9 @@ Scala is a line-oriented language where statements may be terminated by semi-colons or newlines. A newline in a Scala source text is treated as the special token “nl” if the three following criteria are satisfied: -#. The token immediately preceding the newline can terminate a statement. -#. The token immediately following the newline can begin a statement. -#. The token appears in a region where newlines are enabled. +1. The token immediately preceding the newline can terminate a statement. +1. The token immediately following the newline can begin a statement. +1. The token appears in a region where newlines are enabled. The tokens that can terminate a statement are: literals, identifiers and the following delimiters and reserved words: @@ -145,21 +145,21 @@ A `case`{.scala} token can begin a statement only if followed by a Newlines are enabled in: -#. all of a Scala source file, except for nested regions where newlines +1. all of a Scala source file, except for nested regions where newlines are disabled, and -#. the interval between matching `{` and `}` brace tokens, +1. the interval between matching `{` and `}` brace tokens, except for nested regions where newlines are disabled. Newlines are disabled in: -#. the interval between matching `(` and `)` parenthesis tokens, except for +1. the interval between matching `(` and `)` parenthesis tokens, except for nested regions where newlines are enabled, and -#. the interval between matching `[` and `]` bracket tokens, except for nested +1. the interval between matching `[` and `]` bracket tokens, except for nested regions where newlines are enabled. -#. The interval between a `case`{.scala} token and its matching +1. The interval between a `case`{.scala} token and its matching `=>`{.scala} token, except for nested regions where newlines are enabled. -#. Any regions analyzed in [XML mode](#xml-mode). +1. Any regions analyzed in [XML mode](#xml-mode). Note that the brace characters of `{...}` escapes in XML and string literals are not tokens, diff --git a/04-identifiers-names-and-scopes.md b/04-identifiers-names-and-scopes.md index 1266fce2f6..d8e9a6b619 100644 --- a/04-identifiers-names-and-scopes.md +++ b/04-identifiers-names-and-scopes.md @@ -11,12 +11,12 @@ which are collectively called _bindings_. Bindings of different kinds have a precedence defined on them: -#. Definitions and declarations that are local, inherited, or made +1. Definitions and declarations that are local, inherited, or made available by a package clause in the same compilation unit where the definition occurs have highest precedence. -#. Explicit imports have next highest precedence. -#. Wildcard imports have next highest precedence. -#. Definitions made available by a package clause not in the +1. Explicit imports have next highest precedence. +1. Wildcard imports have next highest precedence. +1. Definitions made available by a package clause not in the compilation unit where the definition occurs have lowest precedence. diff --git a/05-types.md b/05-types.md index cad806eeeb..9da7c5b075 100644 --- a/05-types.md +++ b/05-types.md @@ -436,18 +436,18 @@ with lower bound $\sigma L_i$ and upper bound $\sigma U_i$. Existential types obey the following four equivalences: -#. Multiple for-clauses in an existential type can be merged. E.g., +1. Multiple for-clauses in an existential type can be merged. E.g., `$T$ forSome { $Q$ } forSome { $Q'$ }` is equivalent to `$T$ forSome { $Q$ ; $Q'$}`. -#. Unused quantifications can be dropped. E.g., +1. Unused quantifications can be dropped. E.g., `$T$ forSome { $Q$ ; $Q'$}` where none of the types defined in $Q'$ are referred to by $T$ or $Q$, is equivalent to `$T$ forSome {$ Q $}`. -#. An empty quantification can be dropped. E.g., +1. An empty quantification can be dropped. E.g., `$T$ forSome { }` is equivalent to $T$. -#. An existential type `$T$ forSome { $Q$ }` where $Q$ contains +1. An existential type `$T$ forSome { $Q$ }` where $Q$ contains a clause `type $t[\mathit{tps}] >: L <: U$` is equivalent to the type `$T'$ forSome { $Q$ }` where $T'$ results from $T$ by replacing every [covariant occurrence](#variance-annotations) of $t$ in $T$ by $U$ and by @@ -646,15 +646,15 @@ Base Types and Member Definitions Types of class members depend on the way the members are referenced. Central here are three notions, namely: -#. the notion of the set of base types of a type $T$, -#. the notion of a type $T$ in some class $C$ seen from some +1. the notion of the set of base types of a type $T$, +1. the notion of a type $T$ in some class $C$ seen from some prefix type $S$, -#. the notion of the set of member bindings of some type $T$. +1. the notion of the set of member bindings of some type $T$. These notions are defined mutually recursively as follows. -#. The set of _base types_ of a type is a set of class types, +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 @@ -691,7 +691,7 @@ These notions are defined mutually recursively as follows. - 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 notion of a type $T$ _in class $C$ seen from some prefix type $S$_ +1. The notion of a type $T$ _in class $C$ seen from some prefix type $S$_ makes sense only if the prefix type $S$ has a type instance of class $C$ as a base type, say `$S'$#$C$[$T_1 , \ldots , T_n$]`. Then we define as follows. @@ -724,7 +724,7 @@ These notions are defined mutually recursively as follows. then we use ``$T$ seen from $S$'' as a shorthand for ``$T$ in $D$ seen from $S$''. -#. The _member bindings_ of a type $T$ are (1) all bindings $d$ such that +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$ and there exists a definition or declaration $d'$ in $C$ such that $d$ results from $d'$ by replacing every @@ -810,11 +810,11 @@ transitive relation that satisfies the following conditions. - A parameterized type `$T$[$T_1$ , … , $T_n$]` conforms to `$T$[$U_1$ , … , $U_n$]` if the following three conditions hold for $i \in \{ 1 , \ldots , n \}$: - #. If the $i$'th type parameter of $T$ is declared covariant, then + 1. If the $i$'th type parameter of $T$ is declared covariant, then $T_i <: U_i$. - #. If the $i$'th type parameter of $T$ is declared contravariant, then + 1. If the $i$'th type parameter of $T$ is declared contravariant, then $U_i <: T_i$. - #. If the $i$'th type parameter of $T$ is declared neither covariant + 1. If the $i$'th type parameter of $T$ is declared neither covariant nor contravariant, then $U_i \equiv T_i$. - A compound type `$T_1$ with $\ldots$ with $T_n$ {$R\,$}` conforms to each of its component types $T_i$. @@ -952,11 +952,11 @@ A type is _volatile_ if it falls into one of four categories: A compound type `$T_1$ with … with $T_n$ {$R\,$}` is volatile if one of the following two conditions hold. -#. One of $T_2 , \ldots , T_n$ is a type parameter or abstract type, or -#. $T_1$ is an abstract type and and either the refinement $R$ +1. One of $T_2 , \ldots , T_n$ is a type parameter or abstract type, or +1. $T_1$ is an abstract type and and either the refinement $R$ or a type $T_j$ for $j > 1$ contributes an abstract member to the compound type, or -#. one of $T_1 , \ldots , T_n$ is a singleton type. +1. one of $T_1 , \ldots , T_n$ is a singleton type. Here, a type $S$ _contributes an abstract member_ to a type $T$ if diff --git a/08-expressions.md b/08-expressions.md index 6f23cf5c49..e63091c496 100644 --- a/08-expressions.md +++ b/08-expressions.md @@ -140,13 +140,13 @@ is required is the singleton type `$p$.type`. The contexts where a stable type is required are those that satisfy one of the following conditions: -#. The path $p$ occurs as the prefix of a selection and it does not +1. The path $p$ occurs as the prefix of a selection and it does not designate a constant, or -#. The expected type $\mathit{pt}$ is a stable type, or -#. The expected type $\mathit{pt}$ is an abstract type with a stable type as lower +1. The expected type $\mathit{pt}$ is a stable type, or +1. The expected type $\mathit{pt}$ is an abstract type with a stable type as lower bound, and the type $T$ of the entity referred to by $p$ does not conform to $\mathit{pt}$, or -#. The path $p$ designates a module. +1. The path $p$ designates a module. The selection $e.x$ is evaluated by first evaluating the qualifier @@ -730,8 +730,8 @@ An assignment operator is an operator symbol (syntax category “`=`”, with the exception of operators for which one of the following conditions holds: -#. the operator also starts with an equals character, or -#. the operator is one of `(<=)`, `(>=)`, `(!=)`. +1. the operator also starts with an equals character, or +1. the operator is one of `(<=)`, `(>=)`, `(!=)`. Assignment operators are treated specially in that they can be expanded to assignments if no other interpretation is valid. @@ -749,11 +749,11 @@ except that the operation's left-hand-side $l$ is evaluated only once. The re-interpretation occurs if the following two conditions are fulfilled. -#. The left-hand-side $l$ does not have a member named +1. The left-hand-side $l$ does not have a member named `+=`, and also cannot be converted by an [implicit conversion](#implicit-conversions) to a value with a member named `+=`. -#. The assignment `$l$ = $l$ + $r$` is type-correct. +1. The assignment `$l$ = $l$ + $r$` is type-correct. In particular this implies that $l$ refers to a variable or object that can be assigned to, and that is convertible to a value with a member named `+`. diff --git a/09-implicit-parameters-and-views.md b/09-implicit-parameters-and-views.md index 5d380e86b7..202bf8dbd1 100644 --- a/09-implicit-parameters-and-views.md +++ b/09-implicit-parameters-and-views.md @@ -260,20 +260,20 @@ type. Views are applied in three situations. -#. If an expression $e$ is of type $T$, and $T$ does not conform to the +1. If an expression $e$ is of type $T$, and $T$ does not conform to the expression's expected type $\mathit{pt}$. In this case an implicit $v$ is searched which is applicable to $e$ and whose result type conforms to $\mathit{pt}$. The search proceeds as in the case of implicit parameters, where the implicit scope is the one of `$T$ => $\mathit{pt}$`. If such a view is found, the expression $e$ is converted to `$v$($e$)`. -#. In a selection $e.m$ with $e$ of type $T$, if the selector $m$ does +1. In a selection $e.m$ with $e$ of type $T$, if the selector $m$ does not denote a member of $T$. In this case, a view $v$ is searched which is applicable to $e$ and whose result contains a member named $m$. The search proceeds as in the case of implicit parameters, where the implicit scope is the one of $T$. If such a view is found, the selection $e.m$ is converted to `$v$($e$).$m$`. -#. In a selection $e.m(\mathit{args})$ with $e$ of type $T$, if the selector +1. In a selection $e.m(\mathit{args})$ with $e$ of type $T$, if the selector $m$ denotes some member(s) of $T$, but none of these members is applicable to the arguments $\mathit{args}$. In this case a view $v$ is searched which is applicable to $e$ and whose result contains a method $m$ which is applicable to $\mathit{args}$. @@ -402,31 +402,31 @@ the companion object `scala.reflect.ClassManifest` otherwise. Let $M'$ be the tr `Manifest` if $M$ is trait `Manifest`, or be the trait `OptManifest` otherwise. Then the following rules apply. -#. If $T$ is a value class or one of the classes `Any`, `AnyVal`, `Object`, +1. If $T$ is a value class or one of the classes `Any`, `AnyVal`, `Object`, `Null`, or `Nothing`, a manifest for it is generated by selecting the corresponding manifest value `Manifest.$T$`, which exists in the `Manifest` module. -#. If $T$ is an instance of `Array[$S$]`, a manifest is generated +1. If $T$ is an instance of `Array[$S$]`, a manifest is generated with the invocation `$\mathit{Mobj}$.arrayType[S](m)`, where $m$ is the manifest determined for $M[S]$. -#. If $T$ is some other class type $S\#C[U_1 , \ldots , U_n]$ where the prefix +1. If $T$ is some other class type $S\#C[U_1 , \ldots , U_n]$ where the prefix type $S$ cannot be statically determined from the class $C$, a manifest is generated with the invocation `$\mathit{Mobj}$.classType[T]($m_0$, classOf[T], $ms$)` where $m_0$ is the manifest determined for $M'[S]$ and $ms$ are the manifests determined for $M'[U_1] , \ldots , M'[U_n]$. -#. If $T$ is some other class type with type arguments $U_1 , \ldots , U_n$, +1. If $T$ is some other class type with type arguments $U_1 , \ldots , U_n$, a manifest is generated with the invocation `$\mathit{Mobj}$.classType[T](classOf[T], $ms$)` where $ms$ are the manifests determined for $M'[U_1] , \ldots , M'[U_n]$. -#. If $T$ is a singleton type `$p$.type`, a manifest is generated with +1. If $T$ is a singleton type `$p$.type`, a manifest is generated with the invocation `$\mathit{Mobj}$.singleType[T]($p$)` -#. If $T$ is a refined type $T' \{ R \}$, a manifest is generated for $T'$. +1. If $T$ is a refined type $T' \{ R \}$, a manifest is generated for $T'$. (That is, refinements are never reflected in manifests). -#. If $T$ is an intersection type +1. If $T$ is an intersection type `$T_1$ with $, \ldots ,$ with $T_n$` where $n > 1$, the result depends on whether a full manifest is to be determined or not. @@ -437,7 +437,7 @@ Then the following rules apply. Otherwise, if $M$ is trait `ClassManifest`, then a manifest is generated for the [intersection dominator](#type-erasure) of the types $T_1 , \ldots , T_n$. -#. If $T$ is some other type, then if $M$ is trait `OptManifest`, +1. If $T$ is some other type, then if $M$ is trait `OptManifest`, a manifest is generated from the designator `scala.reflect.NoManifest`. If $M$ is a type different from `OptManifest`, a static error results. diff --git a/10-pattern-matching.md b/10-pattern-matching.md index b7fcba9e45..85639c8f7c 100644 --- a/10-pattern-matching.md +++ b/10-pattern-matching.md @@ -33,17 +33,17 @@ than once in a pattern. (@) Some examples of patterns are: - #. The pattern `ex: IOException` matches all instances of class + 1. The pattern `ex: IOException` matches all instances of class `IOException`, binding variable \verb@ex@ to the instance. - #. The pattern `Some(x)` matches values of the form `Some($v$)`, + 1. The pattern `Some(x)` matches values of the form `Some($v$)`, binding `x` to the argument value $v$ of the `Some` constructor. - #. The pattern `(x, _)` matches pairs of values, binding `x` to + 1. The pattern `(x, _)` matches pairs of values, binding `x` to the first component of the pair. The second component is matched with a wildcard pattern. - #. The pattern `x :: y :: xs`{.scala} matches lists of length $\geq 2$, + 1. The pattern `x :: y :: xs`{.scala} matches lists of length $\geq 2$, binding `x` to the list's first element, `y` to the list's second element, and `xs` to the remainder. - #. The pattern `1 | 2 | 3` matches the integers between 1 and 3. + 1. The pattern `1 | 2 | 3` matches the integers between 1 and 3. Pattern matching is always done in a context which supplies an expected type of the pattern. We distinguish the following kinds of @@ -313,9 +313,9 @@ type `Seq[A]`. A pattern $p$ is _irrefutable_ for a type $T$, if one of the following applies: -#. $p$ is a variable pattern, -#. $p$ is a typed pattern $x: T'$, and $T <: T'$, -#. $p$ is a constructor pattern $c(p_1 , \ldots , p_n)$, the type $T$ +1. $p$ is a variable pattern, +1. $p$ is a typed pattern $x: T'$, and $T <: T'$, +1. $p$ is a constructor pattern $c(p_1 , \ldots , p_n)$, the type $T$ is an instance of class $c$, the [primary constructor](#class-definitions) of type $T$ has argument types $T_1 , \ldots , T_n$, and each $p_i$ is irrefutable for $T_i$. diff --git a/14-the-scala-standard-library.md b/14-the-scala-standard-library.md index d03dc53efc..91b9f4c73e 100644 --- a/14-the-scala-standard-library.md +++ b/14-the-scala-standard-library.md @@ -776,16 +776,16 @@ prefers high-priority implicits over low-priority ones. The available low-priority implicits include definitions falling into the following categories. -#. For every primitive type, a wrapper that takes values of that type +1. For every primitive type, a wrapper that takes values of that type to instances of a `runtime.Rich*` class. For instance, values of type `Int` can be implicitly converted to instances of class `runtime.RichInt`. -#. For every array type with elements of primitive type, a wrapper that +1. For every array type with elements of primitive type, a wrapper that takes the arrays of that type to instances of a `runtime.WrappedArray` class. For instance, values of type `Array[Float]` can be implicitly converted to instances of class `runtime.WrappedArray[Float]`. There are also generic array wrappers that take elements of type `Array[T]` for arbitrary `T` to `WrappedArray`s. -#. An implicit conversion from `String` to `WrappedString`. +1. An implicit conversion from `String` to `WrappedString`. The available high-priority implicits include definitions falling into the following categories. @@ -225,7 +225,7 @@ reasonable compromise I found was to treat definitions like quotations: Latex enumerations can be replaced with markdown ordered lists, which have syntax - #. first entry - #. ... - #. last entry + 1. first entry + 1. ... + 1. last entry |