From 90314673008a3bf765cf72d8cbbd3c691f27af03 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Mon, 10 Mar 2014 17:31:12 -0700 Subject: Catch up with latex spec. --- 08-expressions.md | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to '08-expressions.md') diff --git a/08-expressions.md b/08-expressions.md index 140dad39b9..1fe82e9b95 100644 --- a/08-expressions.md +++ b/08-expressions.md @@ -92,9 +92,8 @@ implements methods in class `scala.AnyRef` as follows: - `ne($x\,$)` and `!=($x\,$)` return true iff the argument x is not also the ``null'' object. - `isInstanceOf[$T\,$]` always returns `false`. -- `asInstanceOf[$T\,$]` returns the ``null'' object itself if - $T$ conforms to `scala.AnyRef`, and throws a - `NullPointerException` otherwise. +- `asInstanceOf[$T\,$]` returns the [default value](#value-declarations-and-definitions) of type $T$. +- `##` returns ``0``. A reference to any other member of the ``null'' object causes a `NullPointerException` to be thrown. @@ -122,6 +121,10 @@ If $r$ is a [stable identifier](#paths) of type $T$, the selection $r.x$ refers statically to a term member $m$ of $r$ that is identified in $T$ by the name $x$. + + For other expressions $e$, $e.x$ is typed as if it was `{ val $y$ = $e$; $y$.$x$ }`, for some fresh name $y$. @@ -181,7 +184,7 @@ in the least proper supertype of the innermost template containing the reference. It evaluates to the member $m'$ in the actual supertype of that template which is equal to $m$ or which overrides $m$. The statically referenced member $m$ must be a type or a -method. +method. If it is a method, it must be concrete, or the template @@ -345,8 +348,9 @@ of the caller. If an application might uses named arguments $p = e$ or default arguments, the following conditions must hold. -- The named arguments form a suffix of the argument list $e_1 , \ldots , e_m$, - i.e.\ no positional argument follows a named one. +- For every named argument $p_i = e_i$ which appears left of a positional argument + in the argument list $e_1 \ldots e_m$, the argument position $i$ coincides with + the position of parameter $p_i$ in the parameter list of the applied function. - The names $x_i$ of all named arguments are pairwise distinct and no named argument defines a parameter which is already specified by a positional argument. @@ -920,7 +924,7 @@ Expr1 ::= `for' (`(' Enumerators `)' | `{' Enumerators `}') Enumerators ::= Generator {semi Enumerator} Enumerator ::= Generator | Guard - | `val' Pattern1 `=' Expr + | Pattern1 `=' Expr Generator ::= Pattern1 `<-' Expr [Guard] Guard ::= `if' PostfixExpr ``` @@ -1342,7 +1346,7 @@ Implicit conversions can be applied to expressions whose type does not match their expected type, to qualifiers in selections, and to unapplied methods. The available implicit conversions are given in the next two sub-sections. -We say, a type $T$ is _compatible_ to a type $U$ if $T$ conforms +We say, a type $T$ is _compatible_ to a type $U$ if $T$ weakly conforms to $U$ after applying [eta-expansion](#eta-expansion) and [view applications](#views). @@ -1466,6 +1470,17 @@ 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'': + + - A parameterized method $m$ of type `($p_1:T_1, \ldots , p_n:T_n$)$U$` is _as specific as_ some other member $m'$ of type $S$ if $m'$ is applicable to arguments `($p_1 , \ldots , p_n\,$)` of -- cgit v1.2.3