Skip to content

Fixes Typos in the "Tour of Scala" #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 11, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ For one to contribute a document, one must simply fork the [repo](https://github

## An h2 Header in Markdown

And a paragraph, with a [link](http://www.scala-lang.org.
And a paragraph, with a [link](http://www.scala-lang.org).

One can contribute code by indenting it 4 spaces, or in-line by putting backticks around it like so, `def foo`

Expand Down
6 changes: 3 additions & 3 deletions es/tutorials/tour/abstract-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Traits o [clases](classes.html) con miembros de tipos abstractos son generalment
type U = Int
}

object AbstractTypeTest1 extends Application {
object AbstractTypeTest1 extends App {
def newIntSeqBuf(elem1: Int, elem2: Int): IntSeqBuffer =
new IntSeqBuffer {
type T = List[U]
Expand All @@ -45,7 +45,7 @@ Traits o [clases](classes.html) con miembros de tipos abstractos son generalment
println("content = " + buf.element)
}

El tipo retornado por el método `newIntSeqBuf` está ligado a la especialización del trait `Buffer` en el cual el tipo `U` es ahora equivalente a `Int`. Existe un tipo alias similar en la instancia de la clase anónima dentro del cuerpo del método `newIntSeqBuf`. En ese lugar se crea una nueva instancia de `IntSeqBuffer` en la cual el tipo `T` está ligado a List[Int].
El tipo retornado por el método `newIntSeqBuf` está ligado a la especialización del trait `Buffer` en el cual el tipo `U` es ahora equivalente a `Int`. Existe un tipo alias similar en la instancia de la clase anónima dentro del cuerpo del método `newIntSeqBuf`. En ese lugar se crea una nueva instancia de `IntSeqBuffer` en la cual el tipo `T` está ligado a `List[Int]`.

Es necesario notar que generalmente es posible transformar un tipo abstracto en un tipo paramétrico de una clase y viceversa. A continuación se muestra una versión del código anterior el cual solo usa tipos paramétricos.

Expand All @@ -55,7 +55,7 @@ Es necesario notar que generalmente es posible transformar un tipo abstracto en
abstract class SeqBuffer[U, +T <: Seq[U]] extends Buffer[T] {
def length = element.length
}
object AbstractTypeTest2 extends Application {
object AbstractTypeTest2 extends App {
def newIntSeqBuf(e1: Int, e2: Int): SeqBuffer[Int, Seq[Int]] =
new SeqBuffer[Int, List[Int]] {
val element = List(e1, e2)
Expand Down
6 changes: 3 additions & 3 deletions es/tutorials/tour/annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ El significado de las anotaciones _depende de la implementación_. En la platafo
| [`scala.transient`](http://www.scala-lang.org/api/2.9.1/scala/transient.html) | [`transient`](http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html) (palabra clave) |
| [`scala.unchecked`](http://www.scala-lang.org/api/2.9.1/scala/unchecked.html) (desde 2.4.0) | sin equivalente |
| [`scala.volatile`](http://www.scala-lang.org/api/2.9.1/scala/volatile.html) | [`volatile`](http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html) (palabra clave) |
| [`scala.reflect.BeanProperty`](http://www.scala-lang.org/api/2.9.1/scala/reflect/BeanProperty.html) | [`Design pattern`](http://java.sun.com/docs/books/tutorial/javabeans/properties/properties.html) |
| [`scala.reflect.BeanProperty`](http://www.scala-lang.org/api/2.9.1/scala/reflect/BeanProperty.html) | [`Design pattern`](http://docs.oracle.com/javase/tutorial/javabeans/writing/properties.html) |

En el siguiente ejemplo agregamos la anotación `throws` a la definición del método `read` de manera de capturar la excepción lanzada en el programa principal de Java.

> El compilador de Java comprueba que un programa contenga manejadores para [excepciones comprobadas](http://java.sun.com/docs/books/jls/third_edition/html/exceptions.html) al analizar cuales de esas excepciones comprobadas pueden llegar a lanzarse en la ejecución de un método o un constructor. Por cada excepción comprobada que sea un posible resultado, la cláusula **throws** debe para ese método o constructor debe ser mencionada en la clase de esa excepción o una de las superclases.
> El compilador de Java comprueba que un programa contenga manejadores para [excepciones comprobadas](http://docs.oracle.com/javase/specs/jls/se5.0/html/exceptions.html) al analizar cuales de esas excepciones comprobadas pueden llegar a lanzarse en la ejecución de un método o un constructor. Por cada excepción comprobada que sea un posible resultado, la cláusula **throws** debe para ese método o constructor debe ser mencionada en la clase de esa excepción o una de las superclases.
> Ya que Scala no tiene excepciones comprobadas, los métodos en Scala deben ser anotados con una o más anotaciones `throws` para que el código Java pueda capturar las excepciones lanzadas por un método de Scala.

package examples
Expand All @@ -57,7 +57,7 @@ El siguiente programa de Java imprime en consola los contenidos del archivo cuyo
while ((c = in.read()) != -1) {
System.out.print((char) c);
}
} catch (java.io.Exception e) {
} catch (java.io.IOException e) {
System.out.println(e.getMessage());
}
}
Expand Down
2 changes: 1 addition & 1 deletion es/tutorials/tour/currying.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Métodos pueden definir múltiples listas de parámetros. Cuando un método es i

Aquí se muestra un ejemplo:

object CurryTest extends Application {
object CurryTest extends App {

def filter(xs: List[Int], p: Int => Boolean): List[Int] =
if (xs.isEmpty) xs
Expand Down
6 changes: 3 additions & 3 deletions tutorials/tour/abstract-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Traits or [classes](classes.html) with abstract type members are often used in c
type U = Int
}

object AbstractTypeTest1 extends Application {
object AbstractTypeTest1 extends App {
def newIntSeqBuf(elem1: Int, elem2: Int): IntSeqBuffer =
new IntSeqBuffer {
type T = List[U]
Expand All @@ -45,7 +45,7 @@ Traits or [classes](classes.html) with abstract type members are often used in c
println("content = " + buf.element)
}

The return type of method `newIntSeqBuf` refers to a specialization of trait `Buffer` in which type `U` is now equivalent to `Int`. We have a similar type alias in the anonymous class instantiation within the body of method `newIntSeqBuf`. Here we create a new instance of `IntSeqBuffer` in which type `T` refers to List[Int].
The return type of method `newIntSeqBuf` refers to a specialization of trait `Buffer` in which type `U` is now equivalent to `Int`. We have a similar type alias in the anonymous class instantiation within the body of method `newIntSeqBuf`. Here we create a new instance of `IntSeqBuffer` in which type `T` refers to `List[Int]`.

Please note that it is often possible to turn abstract type members into type parameters of classes and vice versa. Here is a version of the code above which only uses type parameters:

Expand All @@ -55,7 +55,7 @@ Please note that it is often possible to turn abstract type members into type pa
abstract class SeqBuffer[U, +T <: Seq[U]] extends Buffer[T] {
def length = element.length
}
object AbstractTypeTest2 extends Application {
object AbstractTypeTest2 extends App {
def newIntSeqBuf(e1: Int, e2: Int): SeqBuffer[Int, Seq[Int]] =
new SeqBuffer[Int, List[Int]] {
val element = List(e1, e2)
Expand Down
6 changes: 3 additions & 3 deletions tutorials/tour/annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ The meaning of annotation clauses is _implementation-dependent_. On the Java pla
| [`scala.transient`](http://www.scala-lang.org/api/2.9.1/scala/transient.html) | [`transient`](http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html) (keyword) |
| [`scala.unchecked`](http://www.scala-lang.org/api/2.9.1/scala/unchecked.html) (since 2.4.0) | no equivalent |
| [`scala.volatile`](http://www.scala-lang.org/api/2.9.1/scala/volatile.html) | [`volatile`](http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html) (keyword) |
| [`scala.reflect.BeanProperty`](http://www.scala-lang.org/api/2.9.1/scala/reflect/BeanProperty.html) | [`Design pattern`](http://java.sun.com/docs/books/tutorial/javabeans/properties/properties.html) |
| [`scala.reflect.BeanProperty`](http://www.scala-lang.org/api/2.9.1/scala/reflect/BeanProperty.html) | [`Design pattern`](http://docs.oracle.com/javase/tutorial/javabeans/writing/properties.html) |

In the following example we add the `throws` annotation to the definition of the method `read` in order to catch the thrown exception in the Java main program.

> A Java compiler checks that a program contains handlers for [checked exceptions](http://java.sun.com/docs/books/jls/third_edition/html/exceptions.html) by analyzing which checked exceptions can result from execution of a method or constructor. For each checked exception which is a possible result, the **throws** clause for the method or constructor _must_ mention the class of that exception or one of the superclasses of the class of that exception.
> A Java compiler checks that a program contains handlers for [checked exceptions](http://docs.oracle.com/javase/specs/jls/se5.0/html/exceptions.html) by analyzing which checked exceptions can result from execution of a method or constructor. For each checked exception which is a possible result, the **throws** clause for the method or constructor _must_ mention the class of that exception or one of the superclasses of the class of that exception.
> Since Scala has no checked exceptions, Scala methods _must_ be annotated with one or more `throws` annotations such that Java code can catch exceptions thrown by a Scala method.

package examples
Expand All @@ -56,7 +56,7 @@ The following Java program prints out the contents of the file whose name is pas
while ((c = in.read()) != -1) {
System.out.print((char) c);
}
} catch (java.io.Exception e) {
} catch (java.io.IOException e) {
System.out.println(e.getMessage());
}
}
Expand Down
2 changes: 1 addition & 1 deletion tutorials/tour/currying.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Methods may define multiple parameter lists. When a method is called with a fewe

Here is an example:

object CurryTest extends Application {
object CurryTest extends App {

def filter(xs: List[Int], p: Int => Boolean): List[Int] =
if (xs.isEmpty) xs
Expand Down