diff options
author | Martin Odersky <odersky@gmail.com> | 2003-11-07 12:11:21 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2003-11-07 12:11:21 +0000 |
commit | 4bab79034d0056fb9982cbf31491880f961f8b53 (patch) | |
tree | 8cfdc73de23393c12c83098e57fcef34839afeb1 /doc | |
parent | fc7e1bce49d8fd89b25b70277237ed41fb24965d (diff) | |
download | scala-4bab79034d0056fb9982cbf31491880f961f8b53.tar.gz scala-4bab79034d0056fb9982cbf31491880f961f8b53.tar.bz2 scala-4bab79034d0056fb9982cbf31491880f961f8b53.zip |
*** empty log message ***
Diffstat (limited to 'doc')
-rw-r--r-- | doc/reference/ScalaByExample.tex | 4 | ||||
-rw-r--r-- | doc/reference/ScalaReference.tex | 21 |
2 files changed, 15 insertions, 10 deletions
diff --git a/doc/reference/ScalaByExample.tex b/doc/reference/ScalaByExample.tex index bea8c37665..7849be4882 100644 --- a/doc/reference/ScalaByExample.tex +++ b/doc/reference/ScalaByExample.tex @@ -1397,9 +1397,9 @@ As an example of how rational numbers can be used, here's a program that prints the sum of all numbers $1/i$ where $i$ ranges from 1 to 10. \begin{lstlisting} var i = 1; -var x = Rational(0, 1); +var x = new Rational(0, 1); while (i <= 10) { - x = x + Rational(1,i); + x = x + new Rational(1,i); i = i + 1; } System.out.println(x.numer + "/" + x.denom); diff --git a/doc/reference/ScalaReference.tex b/doc/reference/ScalaReference.tex index b5605be662..7b3602d07b 100644 --- a/doc/reference/ScalaReference.tex +++ b/doc/reference/ScalaReference.tex @@ -834,14 +834,6 @@ The erasure mapping is defined as follows. \section{Implicit Conversions} \label{sec:impl-conv} -If $S \conforms T$, then values of type $S$ are implicitly {\em -converted} to values type of $T$ in situations where a value of type -$T$ is required. A conversion between two number types in \code{int}, -\code{long}, \code{float}, \code{double} creates a value of the target -type representing the same number as the source. When used in an -expression, a value of type \code{byte}, \code{char}, \code{short} is -always implicitly converted to a value of type \code{int}. - The following implicit conversions are applied to expressions of method type that are used as values, rather than being applied to some arguments. @@ -878,6 +870,16 @@ would violate the well-formedness rules for anonymous functions parameters always need to be applied to arguments immediately. \end{itemize} +When used in an expression, a value of type \code{byte}, \code{char}, +\code{short} is always implicitly converted to a value of type +\code{int}. + +If an expression $e$ has type $T$ where $T$ does not conform to the +expected type $pt$ and $T$ has a member named \lstinline@coerce@, then +the expression is typed and evaluated is if it was +\listinline@$e$.coerce@. + + \chapter{Basic Declarations and Definitions} \label{sec:defs} @@ -1175,6 +1177,9 @@ and upper bounds that constrain possible type arguments for the parameter. $\pm$ is a {\em variance}, i.e.\ an optional prefix of either \lstinline@+@, or \lstinline@-@. +The upper bound $U$ in a type parameter clauses may denote be a final +class. The lower bound may not denote a value type. + The names of all type parameters in a type parameter clause must be pairwise different. The scope of a type parameter includes in each case the whole type parameter clause. Therefore it is possible that a |