Skip to content

Commit b1f9223

Browse files
authored
Merge branch 'master' into zh-cn-rep
2 parents 77cf982 + f097970 commit b1f9223

File tree

113 files changed

+3463
-281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+3463
-281
lines changed
File renamed without changes.

_ba/tour/compound-types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ partof: scala-tour
99

1010
num: 24
1111
next-page: self-types
12-
previous-page: abstract-types
12+
previous-page: abstract-type-members
1313

1414
---
1515

@@ -56,4 +56,4 @@ def cloneAndReset(obj: Cloneable with Resetable): Cloneable = {
5656
Složeni tipovi mogu se sastojati od više tipova i mogu imati jednu rafinaciju koja može biti korištena da suzi potpis postojećih članova objekta.
5757
General forma je: `A with B with C ... { refinement }`
5858

59-
Primjer za upotrebu rafinacije dat je na stranici o [apstraktnim tipovima](abstract-types.html).
59+
Primjer za upotrebu rafinacije dat je na stranici o [apstraktnim tipovima](abstract-type-members.html).

_ba/tour/inner-classes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ discourse: true
88
partof: scala-tour
99

1010
num: 22
11-
next-page: abstract-types
11+
next-page: abstract-type-members
1212
previous-page: lower-type-bounds
1313

1414
---

_ba/tour/package-objects.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
layout: tour
3+
title: Package Objects
4+
language: ba
5+
6+
discourse: true
7+
8+
partof: scala-tour
9+
10+
num: 36
11+
previous-page: packages-and-imports
12+
---
13+
14+
# Package objects
15+
16+
(this section of the tour has not been translated yet. pull request
17+
with translation welcome!)

_ba/tour/packages-and-imports.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ partof: scala-tour
99

1010
num: 35
1111
previous-page: named-arguments
12-
next-page: type-inference
12+
next-page: package-objects
1313
---
1414

1515
# Packages and Imports

_ba/tour/tour-of-scala.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Konkretno, sistem tipova podržava sljedeće:
4545
* [generičke klase](generic-classes.html)
4646
* [anotacije varijanse](variances.html)
4747
* [gornje](upper-type-bounds.html) i [donje](lower-type-bounds.html) granice tipa,
48-
* [unutarnje klase](inner-classes.html) i [apstraktne tipove](abstract-types.html) kao članove objekta
48+
* [unutarnje klase](inner-classes.html) i [apstraktne tipove](abstract-type-members.html) kao članove objekta
4949
* [složene tipove](compound-types.html)
5050
* [eksplicitno tipizirane samo-reference](self-types.html)
5151
* implicitne [parametre](implicit-parameters.html) i [konverzije](implicit-conversions.html)

_ba/tour/upper-type-bounds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ previous-page: variances
1313

1414
---
1515

16-
U Scali, [tipski parametri](generic-classes.html) i [apstraktni tipovi](abstract-types.html) mogu biti ograničeni granicom tipa.
16+
U Scali, [tipski parametri](generic-classes.html) i [apstraktni tipovi](abstract-type-members.html) mogu biti ograničeni granicom tipa.
1717
Takve granice tipa ograničavaju konkretne vrijednosti tipskih varijabli i ponekad otkrivaju još informacija o članovima takvih tipova.
1818
_Gornja granica tipa_ `T <: A` kaže da se tipska varijabla `T` odnosi na podtip tipa `A`.
1919
Slijedi primjer koji demonstrira gornju granicu tipa za tipski parametar klase `PetContainer`:
File renamed without changes.

_es/tour/annotations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ num: 3
1010
language: es
1111

1212
next-page: classes
13-
previous-page: abstract-types
13+
previous-page: abstract-type-members
1414
---
1515

1616
Las anotaciones sirven para asociar meta-información con definiciones.

_es/tour/compound-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ Los tipos compuestos pueden crearse a partir de varios tipos de objeto y pueden
4444

4545
La forma general es: `A with B with C ... { refinamiento }`
4646

47-
Un ejemplo del uso de los refinamientos se muestra en la página sobre [tipos abstractos](abstract-types.html).
47+
Un ejemplo del uso de los refinamientos se muestra en la página sobre [tipos abstractos](abstract-type-members.html).

_es/tour/package-objects.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
layout: tour
3+
title: Package Objects
4+
language: es
5+
6+
discourse: true
7+
8+
partof: scala-tour
9+
10+
num: 36
11+
previous-page: packages-and-imports
12+
---
13+
14+
# Package objects
15+
16+
(this section of the tour has not been translated yet. pull request
17+
with translation welcome!)

_es/tour/packages-and-imports.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ partof: scala-tour
99

1010
num: 35
1111
previous-page: named-arguments
12-
next-page: type-inference
12+
next-page: package-objects
1313
---
1414

1515
# Packages and Imports

_es/tour/self-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Aquí hay una definición que sirve para describir un grafo:
2828
def agregarNodo: Nodo
2929
}
3030

31-
Los grafos consisten de una lista de nodos y vértices (o aristas en alguna bibliografía) donde tanto el tipo nodo, como el vértice fueron declarados abstractos. El uso de [tipos abstractos](abstract-types.html) permite las implementaciones del trait `Grafo` proveer sus propias clases concretas para nodos y vértices. Además, existe un método `agregarNodo` para agregar nuevos nodos al grafo. Los nodos se conectan entre sí utilizando el método `conectarCon`.
31+
Los grafos consisten de una lista de nodos y vértices (o aristas en alguna bibliografía) donde tanto el tipo nodo, como el vértice fueron declarados abstractos. El uso de [tipos abstractos](abstract-type-members.html) permite las implementaciones del trait `Grafo` proveer sus propias clases concretas para nodos y vértices. Además, existe un método `agregarNodo` para agregar nuevos nodos al grafo. Los nodos se conectan entre sí utilizando el método `conectarCon`.
3232

3333
Una posible implementación de la clase `Grafo`es dada en el siguiente programa:
3434

_es/tour/tour-of-scala.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ partof: scala-tour
99
num: 1
1010
language: es
1111

12-
next-page: abstract-types
12+
next-page: abstract-type-members
1313
---
1414

1515
Scala es un lenguaje de programación moderno multi-paradigma diseñado para expresar patrones de programación comunes de una forma concisa, elegante, y de tipado seguro. Integra fácilmente características de lenguajes orientados a objetos y funcionales.
@@ -27,7 +27,7 @@ Scala cuenta con un expresivo sistema de tipado que fuerza estáticamente las ab
2727
* [Clases genéricas](generic-classes.html)
2828
* [anotaciones variables](variances.html),
2929
* límites de tipado [superiores](upper-type-bounds.html) e [inferiores](lower-type-bounds.html),
30-
* [clases internas](inner-classes.html) y [tipos abstractos](abstract-types.html) como miembros de objetos,
30+
* [clases internas](inner-classes.html) y [tipos abstractos](abstract-type-members.html) como miembros de objetos,
3131
* [tipos compuestos](compound-types.html)
3232
* [auto-referencias explicitamente tipadas](self-types.html)
3333
* [implicit conversions](implicit-conversions.html)

_es/tour/upper-type-bounds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ next-page: lower-type-bounds
1313
previous-page: traits
1414
---
1515

16-
En Scala, los [parámetros de tipo](generic-classes.html) y los [tipos abstractos](abstract-types.html) pueden ser restringidos por un límite de tipado. Tales límites de tipado limitan los valores concretos de las variables de tipo y posiblemente revelan más información acerca de los miembros de tales tipos. Un _límite de tipado superior_ `T <: A` declara que la variable de tipo `T` es un subtipo del tipo `A`.
16+
En Scala, los [parámetros de tipo](generic-classes.html) y los [tipos abstractos](abstract-type-members.html) pueden ser restringidos por un límite de tipado. Tales límites de tipado limitan los valores concretos de las variables de tipo y posiblemente revelan más información acerca de los miembros de tales tipos. Un _límite de tipado superior_ `T <: A` declara que la variable de tipo `T` es un subtipo del tipo `A`.
1717
Aquí se muestra un ejemplo el cual se basa en un límite de tipado superior para la implementación del método polimórfico `findSimilar`:
1818

1919
trait Similar {
File renamed without changes.

_ko/tour/compound-types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ num: 23
1010
language: ko
1111

1212
next-page: self-types
13-
previous-page: abstract-types
13+
previous-page: abstract-type-members
1414
---
1515

1616
때론 객체의 타입을 여러 다른 타입의 서브타입으로 표현해야 할 때가 있다. 스칼라에선 *합성 타입(Compound Types)*으로 표현될 수 있는데, 이는 객체 타입들의 교차점을 의미한다.
@@ -44,6 +44,6 @@ previous-page: abstract-types
4444

4545
합성 타입은 여러 객체 타입으로 구성될 수 있고, 단일 리파인먼트를 가짐으로써 객체 멤버의 시그니처의 범위를 좁힐 수도 있다. 일반적인 형태는 `A with B with C ... { 리파인먼트 }`이다.
4646

47-
리파인먼트 사용 예제는 [추상 타입](abstract-types.html) 에 있다.
47+
리파인먼트 사용 예제는 [추상 타입](abstract-type-members.html) 에 있다.
4848

4949
윤창석, 이한욱 옮김, 고광현 수정

_ko/tour/inner-classes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ partof: scala-tour
99
num: 21
1010
language: ko
1111

12-
next-page: abstract-types
12+
next-page: abstract-type-members
1313
previous-page: lower-type-bounds
1414
---
1515

_ko/tour/package-objects.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
layout: tour
3+
title: Package Objects
4+
language: ko
5+
6+
discourse: true
7+
8+
partof: scala-tour
9+
10+
num: 36
11+
previous-page: packages-and-imports
12+
---
13+
14+
# Package objects
15+
16+
(this section of the tour has not been translated yet. pull request
17+
with translation welcome!)

_ko/tour/packages-and-imports.md

Lines changed: 90 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,101 @@
11
---
22
layout: tour
3-
title: Packages and Imports
4-
language: ko
3+
title: 패키지와 임포트
54

6-
discourse: true
5+
discourse: false
76

87
partof: scala-tour
98

109
num: 35
10+
language: ko
11+
1112
previous-page: named-arguments
12-
next-page: type-inference
13+
next-page: package-objects
1314
---
1415

15-
# Packages and Imports
16+
# 패키지와 임포트
17+
18+
스칼라는 패키지를 사용하여 프로그램을 모듈화할 수 있는 네임스페이스를 만든다.
19+
20+
## 패키지 만들기
21+
22+
패키지는 스칼라 파일 맨 위에 하나 이상의 패키지 이름을 선언하여 만들어진다.
23+
24+
```
25+
package users
26+
27+
class User
28+
```
29+
30+
패키지의 이름을 스칼라 파일을 담고 있는 디렉토리와 같게 하는 규칙이 있다. 하지만, 스칼라는 파일 레이아웃에 한정되지 않는다. `package users`를 위한 sbt 프로젝트의 디렉토리 구조의 한 예이다.
31+
32+
```
33+
- ExampleProject
34+
- build.sbt
35+
- project
36+
- src
37+
- main
38+
- scala
39+
- users
40+
User.scala
41+
UserProfile.scala
42+
UserPreferences.scala
43+
- test
44+
```
45+
46+
`users` 디렉토리가 `scala` 디렉토리 안에 위치하고 여러 스칼라 파일이 패키지 안에 위치하는지에 대해 주목해야 한다. 패키지 안 각 스칼라 파일은 같은 패키지 선언을 가질 수 있다. 패키지를 선언하는 다른 방법은 중괄호를 사용하는 것이다.
47+
48+
```
49+
package users {
50+
package administrators {
51+
class NormalUser
52+
}
53+
package normalusers {
54+
class NormalUser
55+
}
56+
}
57+
```
58+
59+
보다시피 패키지 중첩을 허용하고 스코프와 캡슐화를 더 잘 제어한다.
60+
61+
패키지 이름은 모두 소문자여야 하고 웹사이트를 가진 조직에서 개발된 코드라면 `<상위 도메인>.<도메인 이름>.<프로젝트 이름>` 과 같은 형식을 따라야 한다. 예를 들어, 구글에게 `SelfDrigingCar`라는 프로젝트가 있다면 패키지 이름은 아래와 같을 것이다.
62+
63+
```
64+
package com.google.selfdrivingcar.camera
65+
66+
class Lens
67+
```
68+
69+
디렉토리 구조는 `SelfDrivingCar/src/main/scala/com/google/selfdrivingcar/camera/Lens.scala`와 같을 것이다.
70+
71+
## 임포트
72+
73+
`import` 절은 다른 패키지의 멤버(클래스, 트레이트, 함수 등)에 접근하기 위해서고 같은 패키지의 멤버에 접근할 때는 필요하지 않다. 한마디로 임포트 절은 선택적이다.
74+
75+
```
76+
import users._ // users 패키지 전부를 임포트한다
77+
import users.User // User 클래스를 임포트한다
78+
import users.{User, UserPreferences} // 선택된 멤버만 임포트한다
79+
import users.{UserPreferences => UPrefs} // 편의를 위해 이름을 바꾸고 임포트한다
80+
```
81+
82+
스칼라가 자바와 한가지 다른 점은 어디서든 임포트를 할 수 있다는 것이다.
83+
84+
```tut
85+
def sqrtplus1(x: Int) = {
86+
import scala.math.sqrt
87+
sqrt(x) + 1.0
88+
}
89+
```
90+
91+
네이밍이 중복되거나 프로젝트의 루트에서 무언가 임포트해야 할 때, 패키지 이름 앞에 `_root_`를 붙이면 된다.
92+
93+
```
94+
package accounts
95+
96+
import _root_.users._
97+
```
98+
99+
`scala``java.lang` 패키지와 `object Predef` 는 기본적으로 임포트된다.
16100

17-
(this section of the tour has not been translated yet. pull request
18-
with translation welcome!)
101+
공병국 옮김

_ko/tour/self-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ previous-page: compound-types
2828
def addNode: Node
2929
}
3030

31-
그래프는 노드와 엣지의 리스트로 구성되며, 노드와 엣지의 타입은 모두 추상적으로 남겨뒀다. [추상 타입](abstract-types.html)을 사용해서 트레잇 Graph를 구현할 수 있도록 했고, 이를 통해 노드와 엣지에 해당하는 자신의 콘크리트 클래스를 만들 수 있다. 뿐만 아니라 `addNode`라는 메소드는 그래프에 새로운 노드를 추가해준다. 메소드 `connectWith`를 사용해 노드를 연결한다.
31+
그래프는 노드와 엣지의 리스트로 구성되며, 노드와 엣지의 타입은 모두 추상적으로 남겨뒀다. [추상 타입](abstract-type-members.html)을 사용해서 트레잇 Graph를 구현할 수 있도록 했고, 이를 통해 노드와 엣지에 해당하는 자신의 콘크리트 클래스를 만들 수 있다. 뿐만 아니라 `addNode`라는 메소드는 그래프에 새로운 노드를 추가해준다. 메소드 `connectWith`를 사용해 노드를 연결한다.
3232

3333
다음 클래스는 클래스 `Graph`를 구현하는 한 예다.
3434

_ko/tour/tour-of-scala.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ next-page: basics
2828
* [제네릭 클래스](generic-classes.html)
2929
* [가변성 어노테이션](variances.html)
3030
* [상위 타입 경계](upper-type-bounds.html)[하위 타입 경계](lower-type-bounds.html)
31-
* 객체 멤버로써의 [내부 클래스](inner-classes.html)[추상 타입](abstract-types.html)
31+
* 객체 멤버로써의 [내부 클래스](inner-classes.html)[추상 타입](abstract-type-members.html)
3232
* [합성 타입](compound-types.html)
3333
* [명시적으로 타입이 지정된 자기 참조](self-types.html)
3434
*

_ko/tour/upper-type-bounds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ next-page: lower-type-bounds
1313
previous-page: variances
1414
---
1515

16-
스칼라에선 [타입 파라미터](generic-classes.html)[추상 타입](abstract-types.html)의 타입 경계를 제한할 수 있다. 이런 타입 경계는 타입 변수의 콘크리트 값을 제한하고, 해당 타입의 멤버에 관한 정보를 추가할 수도 있다. _상위 타입 경계_ `T <: A`는 타입 변수 `T`를 선언하면서 서브타입 `A`를 참조하고 있다. 다음은 다형성 메소드 `findSimilar`의 구현을 위해 상위 타입 경계를 사용한 예제다.
16+
스칼라에선 [타입 파라미터](generic-classes.html)[추상 타입](abstract-type-members.html)의 타입 경계를 제한할 수 있다. 이런 타입 경계는 타입 변수의 콘크리트 값을 제한하고, 해당 타입의 멤버에 관한 정보를 추가할 수도 있다. _상위 타입 경계_ `T <: A`는 타입 변수 `T`를 선언하면서 서브타입 `A`를 참조하고 있다. 다음은 다형성 메소드 `findSimilar`의 구현을 위해 상위 타입 경계를 사용한 예제다.
1717

1818
trait Similar {
1919
def isSimilar(x: Any): Boolean

_overviews/core/futures.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ the client in which future the computation failed.
835835
Fatal exceptions (as determined by `NonFatal`) are rethrown in the thread executing
836836
the failed asynchronous computation. This informs the code managing the executing
837837
threads of the problem and allows it to fail fast, if necessary. See
838-
[`NonFatal`](http://www.scala-lang.org/api/current/index.html#scala.util.control.NonFatal$)
838+
[`NonFatal`](https://www.scala-lang.org/api/current/scala/util/control/NonFatal$.html)
839839
for a more precise description of the semantics.
840840

841841
## Promises

_overviews/jdk-compatibility/overview.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ This table shows the first Scala release in each series that works with each JVM
1717

1818
| JVM version | Minimum Scala versions |
1919
|:-----------:|:----------------------------------------------------------------------------------------------|
20-
| 9, 10 | 2.12.4[¹](#jdk-9--up-compatibility-notes), 2.11.12[¹](#jdk-9--up-compatibility-notes), 2.10.7 |
20+
| 11 | 2.12.4, 2.11.12, 2.10.7 |
2121
| 8 | 2.12.0, 2.11.0, 2.10.2 |
2222
| 7 | 2.11.0, 2.10.0 |
2323
| 6 | 2.11.0, 2.10.0 |
2424

25-
25+
For more information on Java 11 (and 9 and 10), see [below](#jdk-9-compatibility-notes).
2626

2727
## Running versus compiling
2828

@@ -40,10 +40,12 @@ For example, Scala 2.12 raised the minimum JVM, for both compiling and running,
4040

4141
Like the 2.12.x series, the Scala 2.13.x series will support Java 8 and higher. (We may bump this to Java 11, but this is unlikely to happen in the 2.x series.)
4242

43-
## ¹JDK 9 & up compatibility notes
43+
## JDK 9+ compatibility notes
44+
45+
Although the table above jumps from 8 to 11, JDK 9 and 10 will probably also work wherever 11 does. But unlike 9 and 10, 11 is an LTS release, so 11 is what we actually test on and recommend.
4446

45-
As of Scala 2.12.6 and 2.11.12, **JDK 9+ support is incomplete**. Notably, `scalac` will not enforce the restrictions of the Java Platform Module System, which means that code that typechecks may incur linkage errors at runtime. Scala 2.13.x will provide [rudimentary support](https://github.com/scala/scala/pull/7218) for this, but likely only in nightlies built on Java 11.
47+
As of Scala 2.12.6 and 2.11.12, **JDK 9+ support is incomplete**. Notably, `scalac` will not enforce the restrictions of the Java Platform Module System, which means that code that typechecks may incur linkage errors at runtime. Scala 2.13.x will eventually provide [rudimentary support](https://github.com/scala/scala/pull/7218) for this, but likely only in nightlies built on Java 11.
4648

4749
JDK 9+ support requires minimum sbt version 1.1.0, or 0.13.17 in the 0.13.x series.
4850

49-
For more information on JDK 9+ compatibility, watch the ["Support JDK 9"](https://github.com/scala/scala-dev/issues/139 "scala/scala-dev #139") issue on GitHub. To help with testing Java 11, the next LTS version, see [scala/scala-dev#559](https://github.com/scala/scala-dev/issues/559).
51+
For more information on JDK 9+ compatibility, watch the ["Support JDK 9"](https://github.com/scala/scala-dev/issues/139 "scala/scala-dev #139") issue on GitHub. To help with testing on Java 11, see [scala/scala-dev#559](https://github.com/scala/scala-dev/issues/559).

_overviews/reflection/symbols-trees-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ nodes that match the pattern `Apply(fun, args)`, where `fun` is some function
573573
(represented by a `Tree`) and `args` is a list of arguments (represented by a
574574
list of `Tree`s).
575575

576-
When a the tree matches the pattern (_i.e.,_ when we have an `Apply` node), we
576+
When a tree matches the pattern (_i.e.,_ when we have an `Apply` node), we
577577
simply add it to our `List[Apply]`, `applies`, and continue our traversal.
578578

579579
Note that, in our match, we call `super.traverse` on the function `fun`

_overviews/reflection/typetags-manifests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ languages: [ja]
1313
permalink: /overviews/reflection/:title.html
1414
---
1515

16-
As with other JVM languages, Scala’s types are erased at compile time. This
16+
As with other JVM languages, Scala’s types are erased at run time. This
1717
means that if you were to inspect the runtime type of some instance, you
1818
might not have access to all type information that the Scala compiler has
1919
available at compile time.

0 commit comments

Comments
 (0)