From 34bbd14189b70d2757bb8e973f6a768f9b3b3459 Mon Sep 17 00:00:00 2001 From: Daniel Barclay Date: Sun, 21 Aug 2016 12:38:04 -0400 Subject: Editorial: Italicized more defining occurrences of terms. --- spec/06-expressions.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'spec/06-expressions.md') diff --git a/spec/06-expressions.md b/spec/06-expressions.md index c24ca01c3b..2deb5f5eec 100644 --- a/spec/06-expressions.md +++ b/spec/06-expressions.md @@ -454,7 +454,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 @@ -480,7 +480,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 @@ -492,7 +492,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 @@ -515,7 +515,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 @@ -560,7 +560,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 @@ -715,7 +715,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: @@ -754,7 +754,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$. @@ -773,7 +773,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$. @@ -868,7 +868,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 @@ -894,7 +894,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. @@ -909,7 +909,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. @@ -923,9 +923,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 @@ -1067,7 +1067,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. @@ -1104,7 +1104,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$ @@ -1122,7 +1122,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) @@ -1311,7 +1311,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 -- cgit v1.2.3