Skip to content

Commit

Permalink
Number files like chapters. Consolidate toc & preface.
Browse files Browse the repository at this point in the history
Aside from the consolidation of title & preface in index.md,
this commit was produced as follows:

```
cd spec/

g mv 03-lexical-syntax.md                      01-lexical-syntax.md
g mv 04-identifiers-names-and-scopes.md        02-identifiers-names-and-scopes.md
g mv 05-types.md                               03-types.md
g mv 06-basic-declarations-and-definitions.md  04-basic-declarations-and-definitions.md
g mv 07-classes-and-objects.md                 05-classes-and-objects.md
g mv 08-expressions.md                         06-expressions.md
g mv 09-implicit-parameters-and-views.md       07-implicit-parameters-and-views.md
g mv 10-pattern-matching.md                    08-pattern-matching.md
g mv 11-top-level-definitions.md               09-top-level-definitions.md
g mv 12-xml-expressions-and-patterns.md        10-xml-expressions-and-patterns.md
g mv 13-user-defined-annotations.md            11-user-defined-annotations.md
g mv 14-the-scala-standard-library.md          12-the-scala-standard-library.md
g mv 15-syntax-summary.md                      13-syntax-summary.md
g mv 16-references.md                          14-references.md

perl -pi -e 's/03-lexical-syntax/01-lexical-syntax/g' *.md
perl -pi -e 's/04-identifiers-names-and-scopes/02-identifiers-names-and-scopes/g' *.md
perl -pi -e 's/05-types/03-types/g' *.md
perl -pi -e 's/06-basic-declarations-and-definitions/04-basic-declarations-and-definitions/g' *.md
perl -pi -e 's/07-classes-and-objects/05-classes-and-objects/g' *.md
perl -pi -e 's/08-expressions/06-expressions/g' *.md
perl -pi -e 's/09-implicit-parameters-and-views/07-implicit-parameters-and-views/g' *.md
perl -pi -e 's/10-pattern-matching/08-pattern-matching/g' *.md
perl -pi -e 's/11-top-level-definitions/09-top-level-definitions/g' *.md
perl -pi -e 's/12-xml-expressions-and-patterns/10-xml-expressions-and-patterns/g' *.md
perl -pi -e 's/13-user-defined-annotations/11-user-defined-annotations/g' *.md
perl -pi -e 's/14-the-scala-standard-library/12-the-scala-standard-library/g' *.md
perl -pi -e 's/15-syntax-summary/13-syntax-summary/g' *.md
perl -pi -e 's/16-references/14-references/g' *.md
```
  • Loading branch information
adriaanm committed Mar 29, 2014
1 parent 0f1dcc4 commit 0b48dc2
Show file tree
Hide file tree
Showing 18 changed files with 212 additions and 206 deletions.
20 changes: 10 additions & 10 deletions spec/03-lexical-syntax.md → spec/01-lexical-syntax.md
Expand Up @@ -189,23 +189,23 @@ that a semicolon in place of the newline would be illegal in every one
of these cases):

- between the condition of a
[conditional expression](08-expressions.html#conditional-expressions)
or [while loop](08-expressions.html#while-loop-expressions) and the next
[conditional expression](06-expressions.html#conditional-expressions)
or [while loop](06-expressions.html#while-loop-expressions) and the next
following expression,
- between the enumerators of a
[for-comprehension](08-expressions.html#for-comprehensions-and-for-loops)
[for-comprehension](06-expressions.html#for-comprehensions-and-for-loops)
and the next following expression, and
- after the initial `type` keyword in a
[type definition or declaration](06-basic-declarations-and-definitions.html#type-declarations-and-type-aliases).
[type definition or declaration](04-basic-declarations-and-definitions.html#type-declarations-and-type-aliases).

A single new line token is accepted

- in front of an opening brace ‘{’, if that brace is a legal
continuation of the current statement or expression,
- after an [infix operator](08-expressions.html#prefix-infix-and-postfix-operations),
- after an [infix operator](06-expressions.html#prefix-infix-and-postfix-operations),
if the first token on the next line can start an expression,
- in front of a [parameter clause](06-basic-declarations-and-definitions.html#function-declarations-and-definitions), and
- after an [annotation](13-user-defined-annotations.html#user-defined-annotations).
- in front of a [parameter clause](04-basic-declarations-and-definitions.html#function-declarations-and-definitions), and
- after an [annotation](11-user-defined-annotations.html#user-defined-annotations).

### Example

Expand Down Expand Up @@ -343,7 +343,7 @@ type `Long` are all integer numbers between $-2^{63}$ and
$2^{63}-1$, inclusive. A compile-time error occurs if an integer literal
denotes a number outside these ranges.

However, if the expected type [_pt_](08-expressions.html#expression-typing) of a literal
However, if the expected type [_pt_](06-expressions.html#expression-typing) of a literal
in an expression is either `Byte`, `Short`, or `Char`
and the integer number fits in the numeric range defined by the type,
then the number is converted to type _pt_ and the literal's type
Expand Down Expand Up @@ -506,7 +506,7 @@ lines.
Method `stripMargin` is defined in class
[scala.collection.immutable.StringLike](http://www.scala-lang.org/api/current/index.html#scala.collection.immutable.StringLike).
Because there is a predefined
[implicit conversion](08-expressions.html#implicit-conversions) from `String` to
[implicit conversion](06-expressions.html#implicit-conversions) from `String` to
`StringLike`, the method is applicable to all strings.


Expand Down Expand Up @@ -541,7 +541,7 @@ symbolLiteral ::= ‘'’ plainid
```

A symbol literal `'x` is a shorthand for the expression
`scala.Symbol("x")`. `Symbol` is a [case class](07-classes-and-objects.html#case-classes),
`scala.Symbol("x")`. `Symbol` is a [case class](05-classes-and-objects.html#case-classes),
which is defined as follows.

```scala
Expand Down
12 changes: 0 additions & 12 deletions spec/01-title.md

This file was deleted.

Expand Up @@ -8,10 +8,10 @@ chapter: 2

Names in Scala identify types, values, methods, and classes which are
collectively called _entities_. Names are introduced by local
[definitions and declarations](06-basic-declarations-and-definitions.html#basic-declarations-and-definitions),
[inheritance](07-classes-and-objects.html#class-members),
[import clauses](06-basic-declarations-and-definitions.html#import-clauses), or
[package clauses](11-top-level-definitions.html#packagings)
[definitions and declarations](04-basic-declarations-and-definitions.html#basic-declarations-and-definitions),
[inheritance](05-classes-and-objects.html#class-members),
[import clauses](04-basic-declarations-and-definitions.html#import-clauses), or
[package clauses](09-top-level-definitions.html#packagings)
which are collectively called _bindings_.

Bindings of different kinds have a precedence defined on them:
Expand All @@ -25,8 +25,8 @@ Bindings of different kinds have a precedence defined on them:
compilation unit where the definition occurs have lowest precedence.


There are two different name spaces, one for [types](05-types.html#types)
and one for [terms](08-expressions.html#expressions). The same name may designate a
There are two different name spaces, one for [types](03-types.html#types)
and one for [terms](06-expressions.html#expressions). The same name may designate a
type and a term, depending on the context where the name is used.

A binding has a _scope_ in which the entity defined by a single
Expand Down Expand Up @@ -67,7 +67,7 @@ of the referenced entity.

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
namespace as the identifier. It is an error if $T$ is not a [value type](05-types.html#value-types).
namespace as the identifier. It is an error if $T$ is not a [value type](03-types.html#value-types).
The type of $e.x$ is the member type of the referenced entity in $T$.


Expand Down
54 changes: 0 additions & 54 deletions spec/02-preface.md

This file was deleted.

30 changes: 15 additions & 15 deletions spec/05-types.md → spec/03-types.md
Expand Up @@ -35,15 +35,15 @@ Value types are either _concrete_ or _abstract_.

Every concrete value type can be represented as a _class type_, i.e. a
[type designator](#type-designators) that refers to a
[class or a trait](07-classes-and-objects.html#class-definitions) [^1], or as a
[class or a trait](05-classes-and-objects.html#class-definitions) [^1], or as a
[compound type](#compound-types) representing an
intersection of types, possibly with a [refinement](#compound-types)
that further constrains the types of its members.
<!--
A shorthand exists for denoting [function types](#function-types)
-->
Abstract value types are introduced by [type parameters](06-basic-declarations-and-definitions.html#type-parameters)
and [abstract type bindings](06-basic-declarations-and-definitions.html#type-declarations-and-type-aliases).
Abstract value types are introduced by [type parameters](04-basic-declarations-and-definitions.html#type-parameters)
and [abstract type bindings](04-basic-declarations-and-definitions.html#type-declarations-and-type-aliases).
Parentheses in types can be used for grouping.

[^1]: We assume that objects and packages also implicitly
Expand Down Expand Up @@ -108,7 +108,7 @@ SimpleType ::= Path ‘.’ type
```

A singleton type is of the form `$p$.type`, where $p$ is a
path pointing to a value expected to [conform](08-expressions.html#expression-typing)
path pointing to a value expected to [conform](06-expressions.html#expression-typing)
to `scala.AnyRef`. The type denotes the set of values
consisting of `null` and the value denoted by $p$.

Expand Down Expand Up @@ -259,7 +259,7 @@ AnnotType ::= SimpleType {Annotation}
```

An annotated type $T$ `$a_1 , \ldots , a_n$`
attaches [annotations](13-user-defined-annotations.html#user-defined-annotations)
attaches [annotations](11-user-defined-annotations.html#user-defined-annotations)
$a_1 , \ldots , a_n$ to the type $T$.

### Example
Expand Down Expand Up @@ -288,7 +288,7 @@ $T_1 , \ldots , T_n$ and the refinement `{ $R$ }`. A refinement
`{ $R$ }` contains declarations and type definitions.
If a declaration or definition overrides a declaration or definition in
one of the component types $T_1 , \ldots , T_n$, the usual rules for
[overriding](07-classes-and-objects.html#overriding) apply; otherwise the declaration
[overriding](05-classes-and-objects.html#overriding) apply; otherwise the declaration
or definition is said to be “structural” [^2].

[^2]: A reference to a structurally defined member (method call or access
Expand Down Expand Up @@ -355,10 +355,10 @@ $T_2$. The type is equivalent to the type application
`$\mathit{op}$[$T_1$, $T_2$]`. The infix operator $\mathit{op}$ may be an
arbitrary identifier,
except for `*`, which is reserved as a postfix modifier
denoting a [repeated parameter type](06-basic-declarations-and-definitions.html#repeated-parameters).
denoting a [repeated parameter type](04-basic-declarations-and-definitions.html#repeated-parameters).

All type infix operators have the same precedence; parentheses have to
be used for grouping. The [associativity](08-expressions.html#prefix-infix-and-postfix-operations)
be used for grouping. The [associativity](06-expressions.html#prefix-infix-and-postfix-operations)
of a type operator is determined as for term operators: type operators
ending in a colon ‘:’ are right-associative; all other
operators are left-associative.
Expand All @@ -385,7 +385,7 @@ values that take arguments of types $T1 , \ldots , Tn$ and yield
results of type $U$. In the case of exactly one argument type
$T \Rightarrow U$ is a shorthand for $(T) \Rightarrow U$.
An argument type of the form $\Rightarrow T$
represents a [call-by-name parameter](06-basic-declarations-and-definitions.html#by-name-parameters) of type $T$.
represents a [call-by-name parameter](04-basic-declarations-and-definitions.html#by-name-parameters) of type $T$.

Function types associate to the right, e.g.
$S \Rightarrow T \Rightarrow U$ is the same as
Expand All @@ -405,7 +405,7 @@ trait Function_n[-T1 , … , -T$_n$, +R] {
}
```

Hence, function types are [covariant](06-basic-declarations-and-definitions.html#variance-annotations) in their
Hence, function types are [covariant](04-basic-declarations-and-definitions.html#variance-annotations) in their
result type and contravariant in their argument types.

### Existential Types
Expand All @@ -420,7 +420,7 @@ ExistentialDcl ::= ‘type’ TypeDcl

An existential type has the form `$T$ forSome { $Q$ }`
where $Q$ is a sequence of
[type declarations](06-basic-declarations-and-definitions.html#type-declarations-and-type-aliases).
[type declarations](04-basic-declarations-and-definitions.html#type-declarations-and-type-aliases).

Let
$t_1[\mathit{tps}_1] >: L_1 <: U_1 , \ldots , t_n[\mathit{tps}_n] >: L_n <: U_n$
Expand Down Expand Up @@ -462,7 +462,7 @@ is equivalent to
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](06-basic-declarations-and-definitions.html#variance-annotations) of $t$ in $T$ by $U$ and by
every [covariant occurrence](04-basic-declarations-and-definitions.html#variance-annotations) of $t$ in $T$ by $U$ and by
replacing every contravariant occurrence of $t$ in $T$ by $L$.


Expand Down Expand Up @@ -591,7 +591,7 @@ that are re-evaluated each time the parameterless method name is
referenced.

Method types do not exist as types of values. If a method name is used
as a value, its type is [implicitly converted](08-expressions.html#implicit-conversions) to a
as a value, its type is [implicitly converted](06-expressions.html#implicit-conversions) to a
corresponding function type.

###### Example
Expand Down Expand Up @@ -645,8 +645,8 @@ union : [A >: Nothing <: Comparable[A]] (x: Set[A], xs: Set[A]) Set[A] .
A type constructor is represented internally much like a polymorphic method type.
`[$\pm$ $a_1$ >: $L_1$ <: $U_1 , \ldots , \pm a_n$ >: $L_n$ <: $U_n$] $T$`
represents a type that is expected by a
[type constructor parameter](06-basic-declarations-and-definitions.html#type-parameters) or an
[abstract type constructor binding](06-basic-declarations-and-definitions.html#type-declarations-and-type-aliases) with
[type constructor parameter](04-basic-declarations-and-definitions.html#type-parameters) or an
[abstract type constructor binding](04-basic-declarations-and-definitions.html#type-declarations-and-type-aliases) with
the corresponding type parameter clause.

###### Example
Expand Down

0 comments on commit 0b48dc2

Please sign in to comment.