Skip to content

Commit

Permalink
Merge pull request scala#5355 from dsbos/dsbos-SpecEdits
Browse files Browse the repository at this point in the history
Italicize more defining occurrences of terms in Scala lang. spec.
  • Loading branch information
adriaanm authored Aug 22, 2016
2 parents 7039097 + 34bbd14 commit 7470207
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 54 deletions.
22 changes: 11 additions & 11 deletions spec/03-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ forms.
SimpleType ::= Path ‘.’ type
```

A singleton type is of the form $p.$`type`, where $p$ is a
A _singleton type_ is of the form $p.$`type`, where $p$ is a
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 All @@ -119,7 +119,7 @@ declared to be a subtype of trait `scala.Singleton`.
SimpleType ::= SimpleType ‘#’ id
```

A type projection $T$#$x$ references the type member named
A _type projection_ $T$#$x$ references the type member named
$x$ of type $T$.

<!--
Expand All @@ -134,7 +134,7 @@ If $x$ references an abstract type member, then $T$ must be a
SimpleType ::= StableId
```

A type designator refers to a named value type. It can be simple or
A _type designator_ refers to a named value type. It can be simple or
qualified. All such type designators are shorthands for type projections.

Specifically, the unqualified type name $t$ where $t$ is bound in some
Expand Down Expand Up @@ -167,7 +167,7 @@ SimpleType ::= SimpleType TypeArgs
TypeArgs ::= ‘[’ Types ‘]’
```

A parameterized type $T[ T_1 , \ldots , T_n ]$ consists of a type
A _parameterized type_ $T[ T_1 , \ldots , T_n ]$ consists of a type
designator $T$ and type parameters $T_1 , \ldots , T_n$ where
$n \geq 1$. $T$ must refer to a type constructor which takes $n$ type
parameters $a_1 , \ldots , a_n$.
Expand Down Expand Up @@ -227,7 +227,7 @@ G[S, Int] // illegal: S constrains its parameter to
SimpleType ::= ‘(’ Types ‘)’
```

A tuple type $(T_1 , \ldots , T_n)$ is an alias for the
A _tuple type_ $(T_1 , \ldots , T_n)$ is an alias for the
class `scala.Tuple$n$[$T_1$, … , $T_n$]`, where $n \geq 2$.

Tuple classes are case classes whose fields can be accessed using
Expand Down Expand Up @@ -255,7 +255,7 @@ trait Product_n[+$T_1$, … , +$T_n$] {
AnnotType ::= SimpleType {Annotation}
```

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

Expand All @@ -278,7 +278,7 @@ RefineStat ::= Dcl
|
```

A compound type $T_1$ `with``with` $T_n \\{ R \\}$
A _compound type_ $T_1$ `with``with` $T_n \\{ R \\}$
represents objects with members as given in the component types
$T_1 , \ldots , T_n$ and the refinement $\\{ R \\}$. A refinement
$\\{ R \\}$ contains declarations and type definitions.
Expand Down Expand Up @@ -343,7 +343,7 @@ a value `callsign` and a `fly` method.
InfixType ::= CompoundType {id [nl] CompoundType}
```

An infix type $T_1$ `op` $T_2$ consists of an infix
An _infix type_ $T_1$ `op` $T_2$ consists of an infix
operator `op` which gets applied to two type operands $T_1$ and
$T_2$. The type is equivalent to the type application
`op`$[T_1, T_2]$. The infix operator `op` may be an
Expand Down Expand Up @@ -410,7 +410,7 @@ ExistentialDcl ::= ‘type’ TypeDcl
| ‘val’ ValDcl
```

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

Expand Down Expand Up @@ -564,7 +564,7 @@ report as the internal types of defined identifiers.

### Method Types

A method type is denoted internally as $(\mathit{Ps})U$, where $(\mathit{Ps})$
A _method type_ is denoted internally as $(\mathit{Ps})U$, where $(\mathit{Ps})$
is a sequence of parameter names and types $(p_1:T_1 , \ldots , p_n:T_n)$
for some $n \geq 0$ and $U$ is a (value or method) type. This type
represents named methods that take arguments named $p_1 , \ldots , p_n$
Expand Down Expand Up @@ -631,7 +631,7 @@ union : [A >: Nothing <: Comparable[A]] (x: Set[A], xs: Set[A]) Set[A]

### Type Constructors

A type constructor is represented internally much like a polymorphic method type.
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](04-basic-declarations-and-definitions.html#type-parameters) or an
Expand Down
12 changes: 6 additions & 6 deletions spec/04-basic-declarations-and-definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,9 @@ ParamType ::= Type
| Type ‘*’
```

A function declaration has the form `def $f\,\mathit{psig}$: $T$`, where
A _function declaration_ has the form `def $f\,\mathit{psig}$: $T$`, where
$f$ is the function's name, $\mathit{psig}$ is its parameter
signature and $T$ is its result type. A function definition
signature and $T$ is its result type. A _function definition_
`def $f\,\mathit{psig}$: $T$ = $e$` also includes a _function body_ $e$,
i.e. an expression which defines the function's result. A parameter
signature consists of an optional type parameter clause `[$\mathit{tps}\,$]`,
Expand All @@ -612,13 +612,13 @@ result type, if one is given. If the function definition is not
recursive, the result type may be omitted, in which case it is
determined from the packed type of the function body.

A type parameter clause $\mathit{tps}$ consists of one or more
A _type parameter clause_ $\mathit{tps}$ consists of one or more
[type declarations](#type-declarations-and-type-aliases), which introduce type
parameters, possibly with bounds. The scope of a type parameter includes
the whole signature, including any of the type parameter bounds as
well as the function body, if it is present.

A value parameter clause $\mathit{ps}$ consists of zero or more formal
A _value parameter clause_ $\mathit{ps}$ consists of zero or more formal
parameter bindings such as `$x$: $T$` or `$x: T = e$`, which bind value
parameters and associate them with their types.

Expand Down Expand Up @@ -774,12 +774,12 @@ FunDef ::= FunSig [nl] ‘{’ Block ‘}’

Special syntax exists for procedures, i.e. functions that return the
`Unit` value `()`.
A procedure declaration is a function declaration where the result type
A _procedure declaration_ is a function declaration where the result type
is omitted. The result type is then implicitly completed to the
`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
A _procedure definition_ is a function definition where the result type
and the equals sign are omitted; its defining expression must be a block.
E.g., `def $f$($\mathit{ps}$) {$\mathit{stats}$}` is equivalent to
`def $f$($\mathit{ps}$): Unit = {$\mathit{stats}$}`.
Expand Down
6 changes: 3 additions & 3 deletions spec/05-classes-and-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SelfType ::= id [`:' Type] `=>'
| this `:' Type `=>'
```

A template defines the type signature, behavior and initial state of a
A _template_ defines the type signature, behavior and initial state of a
trait or class of objects or of a single object. Templates form part of
instance creation expressions, class definitions, and object
definitions. A template
Expand Down Expand Up @@ -972,7 +972,7 @@ TraitDef ::= id [TypeParamClause] TraitTemplateOpt
TraitTemplateOpt ::= `extends' TraitTemplate | [[`extends'] TemplateBody]
```

A trait is a class that is meant to be added to some other class
A _trait_ is a class that is meant to be added to some other class
as a mixin. Unlike normal classes, traits cannot have
constructor parameters. Furthermore, no constructor arguments are
passed to the superclass of the trait. This is not necessary as traits are
Expand Down Expand Up @@ -1074,7 +1074,7 @@ in `MyTable`.
ObjectDef ::= id ClassTemplate
```

An object definition defines a single object of a new class. Its
An _object definition_ defines a single object of a new class. Its
most general form is
`object $m$ extends $t$`. Here,
$m$ is the name of the object to be defined, and
Expand Down
36 changes: 18 additions & 18 deletions spec/06-expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ because otherwise the underscore would be considered part of the name.
SimpleExpr ::= SimpleExpr TypeArgs
```

A type application `$e$[$T_1 , \ldots , T_n$]` instantiates
A _type application_ `$e$[$T_1 , \ldots , T_n$]` instantiates
a polymorphic value $e$ of type
`[$a_1$ >: $L_1$ <: $U_1, \ldots , a_n$ >: $L_n$ <: $U_n$]$S$`
with argument types
Expand All @@ -462,7 +462,7 @@ and the expected result type.
SimpleExpr ::= `(' [Exprs] `)'
```

A tuple expression `($e_1 , \ldots , e_n$)` is an alias
A _tuple expression_ `($e_1 , \ldots , e_n$)` is an alias
for the class instance creation
`scala.Tuple$n$($e_1 , \ldots , e_n$)`, where $n \geq 2$.
The empty tuple
Expand All @@ -474,7 +474,7 @@ The empty tuple
SimpleExpr ::= `new' (ClassTemplate | TemplateBody)
```

A simple instance creation expression is of the form
A _simple instance creation expression_ is of the form
`new $c$`
where $c$ is a [constructor invocation](05-classes-and-objects.html#constructor-invocations). Let $T$ be
the type of $c$. Then $T$ must
Expand All @@ -497,7 +497,7 @@ The expression is evaluated by creating a fresh
object of type $T$ which is initialized by evaluating $c$. The
type of the expression is $T$.

A general instance creation expression is of the form
A _general instance creation expression_ is of the form
`new $t$` for some [class template](05-classes-and-objects.html#templates) $t$.
Such an expression is equivalent to the block

Expand Down Expand Up @@ -542,7 +542,7 @@ BlockExpr ::= ‘{’ CaseClauses ‘}’
Block ::= BlockStat {semi BlockStat} [ResultExpr]
```

A block expression `{$s_1$; $\ldots$; $s_n$; $e\,$}` is
A _block expression_ `{$s_1$; $\ldots$; $s_n$; $e\,$}` is
constructed from a sequence of block statements $s_1 , \ldots , s_n$
and a final expression $e$. The statement sequence may not contain
two definitions or declarations that bind the same name in the same
Expand Down Expand Up @@ -697,7 +697,7 @@ name.

### Assignment Operators

An assignment operator is an operator symbol (syntax category
An _assignment operator_ is an operator symbol (syntax category
`op` in [Identifiers](01-lexical-syntax.html#identifiers)) that ends in an equals character
`=`”, with the exception of operators for which one of
the following conditions holds:
Expand Down Expand Up @@ -736,7 +736,7 @@ The re-interpretation occurs if the following two conditions are fulfilled.
Expr1 ::= PostfixExpr `:' CompoundType
```

The typed expression $e: T$ has type $T$. The type of
The _typed expression_ $e: T$ has type $T$. The type of
expression $e$ is expected to conform to $T$. The result of
the expression is the value of $e$ converted to type $T$.

Expand All @@ -755,7 +755,7 @@ Here are examples of well-typed and ill-typed expressions.
Expr1 ::= PostfixExpr `:' Annotation {Annotation}
```

An annotated expression `$e$: @$a_1$ $\ldots$ @$a_n$`
An _annotated expression_ `$e$: @$a_1$ $\ldots$ @$a_n$`
attaches [annotations](11-annotations.html#user-defined-annotations) $a_1 , \ldots , a_n$ to the
expression $e$.

Expand Down Expand Up @@ -850,7 +850,7 @@ def matmul(xss: Array[Array[Double]], yss: Array[Array[Double]]) = {
Expr1 ::= `if' `(' Expr `)' {nl} Expr [[semi] `else' Expr]
```

The conditional expression `if ($e_1$) $e_2$ else $e_3$` chooses
The _conditional expression_ `if ($e_1$) $e_2$ else $e_3$` chooses
one of the values of $e_2$ and $e_3$, depending on the
value of $e_1$. The condition $e_1$ is expected to
conform to type `Boolean`. The then-part $e_2$ and the
Expand All @@ -876,7 +876,7 @@ evaluated as if it was `if ($e_1$) $e_2$ else ()`.
Expr1 ::= `while' `(' Expr ')' {nl} Expr
```

The while loop expression `while ($e_1$) $e_2$` is typed and
The _while loop expression_ `while ($e_1$) $e_2$` is typed and
evaluated as if it was an application of `whileLoop ($e_1$) ($e_2$)` where
the hypothetical function `whileLoop` is defined as follows.

Expand All @@ -891,7 +891,7 @@ def whileLoop(cond: => Boolean)(body: => Unit): Unit =
Expr1 ::= `do' Expr [semi] `while' `(' Expr ')'
```

The do loop expression `do $e_1$ while ($e_2$)` is typed and
The _do loop expression_ `do $e_1$ while ($e_2$)` is typed and
evaluated as if it was the expression `($e_1$ ; while ($e_2$) $e_1$)`.
A semicolon preceding the `while` symbol of a do loop expression is ignored.

Expand All @@ -905,9 +905,9 @@ Generator ::= Pattern1 `<-' Expr {[semi] Guard | semi Pattern1 `=' Expr}
Guard ::= `if' PostfixExpr
```

A for loop `for ($\mathit{enums}\,$) $e$` executes expression $e$
for each binding generated by the enumerators $\mathit{enums}$. A for
comprehension `for ($\mathit{enums}\,$) yield $e$` evaluates
A _for loop_ `for ($\mathit{enums}\,$) $e$` executes expression $e$
for each binding generated by the enumerators $\mathit{enums}$.
A _for comprehension_ `for ($\mathit{enums}\,$) yield $e$` evaluates
expression $e$ for each binding generated by the enumerators $\mathit{enums}$
and collects the results. An enumerator sequence always starts with a
generator; this can be followed by further generators, value
Expand Down Expand Up @@ -1049,7 +1049,7 @@ The code above makes use of the fact that `map`, `flatMap`,
Expr1 ::= `return' [Expr]
```

A return expression `return $e$` must occur inside the body of some
A _return expression_ `return $e$` must occur inside the body of some
enclosing named method or function. The innermost enclosing named
method or function in a source program, $f$, must have an explicitly declared result type,
and the type of $e$ must conform to it.
Expand Down Expand Up @@ -1086,7 +1086,7 @@ and will propagate up the call stack.
Expr1 ::= `throw' Expr
```

A throw expression `throw $e$` evaluates the expression
A _throw expression_ `throw $e$` evaluates the expression
$e$. The type of this expression must conform to
`Throwable`. If $e$ evaluates to an exception
reference, evaluation is aborted with the thrown exception. If $e$
Expand All @@ -1104,7 +1104,7 @@ Expr1 ::= `try' (`{' Block `}' | Expr) [`catch' `{' CaseClauses `}']
[`finally' Expr]
```

A try expression is of the form `try { $b$ } catch $h$`
A _try expression_ is of the form `try { $b$ } catch $h$`
where the handler $h$ is a
[pattern matching anonymous function](08-pattern-matching.html#pattern-matching-anonymous-functions)

Expand Down Expand Up @@ -1278,7 +1278,7 @@ TemplateStat ::= Import
|
```

Statements occur as parts of blocks and templates. A statement can be
Statements occur as parts of blocks and templates. A _statement_ can be
an import, a definition or an expression, or it can be empty.
Statements used in the template of a class definition can also be
declarations. An expression that is used as a statement can have an
Expand Down
2 changes: 1 addition & 1 deletion spec/07-implicits.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object Monoids {

## Implicit Parameters

An implicit parameter list
An _implicit parameter list_
`(implicit $p_1$,$\ldots$,$p_n$)` of a method marks the parameters $p_1 , \ldots , p_n$ as
implicit. A method or constructor can have only one implicit parameter
list, and it must be the last parameter list given.
Expand Down
Loading

0 comments on commit 7470207

Please sign in to comment.