diff --git a/contribute.md b/contribute.md index 7de3ce1d02..42766ffad9 100644 --- a/contribute.md +++ b/contribute.md @@ -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` diff --git a/es/tutorials/tour/abstract-types.md b/es/tutorials/tour/abstract-types.md index f07d630321..4d91f5abc9 100644 --- a/es/tutorials/tour/abstract-types.md +++ b/es/tutorials/tour/abstract-types.md @@ -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] @@ -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. @@ -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) diff --git a/es/tutorials/tour/annotations.md b/es/tutorials/tour/annotations.md index 64986900d3..56435650a6 100644 --- a/es/tutorials/tour/annotations.md +++ b/es/tutorials/tour/annotations.md @@ -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 @@ -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()); } } diff --git a/es/tutorials/tour/currying.md b/es/tutorials/tour/currying.md index f3c13c9e13..118ab193cc 100644 --- a/es/tutorials/tour/currying.md +++ b/es/tutorials/tour/currying.md @@ -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 diff --git a/tutorials/tour/abstract-types.md b/tutorials/tour/abstract-types.md index 4f6dd68443..f1e2034613 100644 --- a/tutorials/tour/abstract-types.md +++ b/tutorials/tour/abstract-types.md @@ -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] @@ -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: @@ -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) diff --git a/tutorials/tour/annotations.md b/tutorials/tour/annotations.md index 1c058c373e..3094d4d924 100644 --- a/tutorials/tour/annotations.md +++ b/tutorials/tour/annotations.md @@ -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 @@ -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()); } } diff --git a/tutorials/tour/currying.md b/tutorials/tour/currying.md index 0dd18f1100..c1e9dbe7e8 100644 --- a/tutorials/tour/currying.md +++ b/tutorials/tour/currying.md @@ -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