Skip to content

Commit db66dab

Browse files
committed
Add scala 3 book in russian
1 parent ce824b0 commit db66dab

File tree

2 files changed

+50
-45
lines changed

2 files changed

+50
-45
lines changed

_ru/scala3/book/scala-features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ JSON библиотеки:
448448

449449
### ИИ, машинное обучение
450450

451-
- [BigDL](https://github.com/intel-analytics/BigDL) (Distributed Deep Learning Framework for Apache Spark) for Apache Spark
451+
- [BigDL](https://github.com/intel-analytics/BigDL) (Распределенная среда глубокого обучения для Apache Spark)
452452
- [TensorFlow Scala](https://github.com/eaplatanios/tensorflow_scala)
453453

454454

_ru/scala3/book/why-scala-3.md

Lines changed: 49 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,28 @@ next-page: taste-intro
1515
Использование Scala, и Scala 3 в частности, дает много преимуществ.
1616
Трудно перечислить их все, но “топ десять” может выглядеть так:
1717

18-
1. Scala embraces a fusion of functional programming (FP) and object-oriented programming (OOP)
19-
2. Scala is statically typed, but often feels like a dynamically typed language
20-
3. Scala’s syntax is concise, but still readable; it’s often referred to as _expressive_
21-
4. _Implicits_ in Scala 2 were a defining feature, and they have been improved and simplified in Scala 3
22-
5. Scala integrates seamlessly with Java, so you can create projects with mixed Scala and Java code, and Scala code easily uses the thousands of existing Java libraries
23-
6. Scala can be used on the server, and also in the browser with [Scala.js](https://www.scala-js.org)
24-
7. The Scala standard library has dozens of pre-built, functional methods to save you time, and greatly reduce the need to write custom `for` loops and algorithms
25-
8. “Best practices” are built into Scala, which favors immutability, anonymous functions, higher-order functions, pattern matching, classes that cannot be extended by default, and more
26-
9. The Scala ecosystem offers the most modern FP libraries in the world
27-
10. Strong type system
18+
1. Scala сочетает в себе функциональное программирование (ФП) и объектно-ориентированное программирование (ООП)
19+
2. Scala статически типизирован, но часто ощущается как язык с динамической типизацией
20+
3. Синтаксис Scala лаконичен, но все же удобочитаем; его часто называют _выразительным_
21+
4. _Implicits_ в Scala 2 были определяющей функцией, а в Scala 3 они были улучшены и упрощены
22+
5. Scala легко интегрируется с Java, поэтому вы можете создавать проекты со смешанным кодом Scala и Java, а код Scala легко использует тысячи существующих библиотек Java
23+
6. Scala можно использовать на сервере, а также в браузере со [Scala.js](https://www.scala-js.org)
24+
7. Стандартная библиотека Scala содержит десятки готовых функциональных методов, позволяющих сэкономить ваше время и значительно сократить потребность в написании пользовательских циклов `for` и алгоритмов
25+
8. “Best practices”, встроенные в Scala, поддерживают неизменность, анонимные функции, функции высшего порядка, сопоставление с образцом, классы, которые не могут быть расширены по умолчанию, и многое другое
26+
9. Экосистема Scala предлагает самые современные ФП библиотеки в мире
27+
10. Сильная система типов
2828

29-
## 1) FP/OOP fusion
3029

31-
More than any other language, Scala supports a fusion of the FP and OOP paradigms.
32-
As Martin Odersky has stated, the essence of Scala is a fusion of functional and object-oriented programming in a typed setting, with:
30+
## 1) Слияние ФП/ООП
3331

34-
- Functions for the logic, and
35-
- Objects for the modularity
32+
Больше, чем любой другой язык, Scala поддерживает слияние парадигм ФП и ООП.
33+
Как заявил Мартин Одерски, сущность Scala — это слияние функционального и объектно-ориентированного программирования в типизированной среде с:
3634

37-
Possibly some of the best examples of modularity are the classes in the standard library.
38-
For instance, a `List` is defined as a class---technically it’s an abstract class---and a new instance is created like this:
35+
- Функции для логики и
36+
- Объекты для модульности
37+
38+
Возможно, одними из лучших примеров модульности являются классы стандартной библиотеки.
39+
Например, `List` определяется как класс---технически это абстрактный класс---и новый экземпляр создается следующим образом:
3940

4041
{% tabs list %}
4142
{% tab 'Scala 2 and 3' for=list %}
@@ -45,10 +46,12 @@ val x = List(1, 2, 3)
4546
{% endtab %}
4647
{% endtabs %}
4748

48-
However, what appears to the programmer to be a simple `List` is actually built from a combination of several specialized types, including traits named `Iterable`, `Seq`, and `LinearSeq`.
49-
Those types are similarly composed of other small, modular units of code.
49+
Однако то, что кажется программисту простым `List`, на самом деле построено из комбинации нескольких специализированных типов,
50+
включая трейты с именами `Iterable`, `Seq` и `LinearSeq`.
51+
Эти типы также состоят из других небольших модульных единиц кода.
5052

51-
In addition to building a type like `List` from a series of modular traits, the `List` API also consists of dozens of other methods, many of which are higher-order functions:
53+
В дополнение к построению типа наподобие `List` из серии модульных трейтов,
54+
`List` API также состоит из десятков других методов, многие из которых являются функциями высшего порядка:
5255

5356
{% tabs list-methods %}
5457
{% tab 'Scala 2 and 3' for=list-methods %}
@@ -63,13 +66,13 @@ xs.takeWhile(_ < 3) // List(1, 2)
6366
{% endtab %}
6467
{% endtabs %}
6568

66-
In those examples, the values in the list can’t be modified.
67-
The `List` class is immutable, so all of those methods return new values, as shown by the data in each comment.
69+
В этих примерах значения в списке не могут быть изменены.
70+
Класс `List` неизменяем, поэтому все эти методы возвращают новые значения, как показано в каждом комментарии.
6871

69-
## 2) A dynamic feel
72+
## 2) Ощущение динамики
7073

71-
Scala’s _type inference_ often makes the language feel dynamically typed, even though it’s statically typed.
72-
This is true with variable declaration:
74+
_Вывод типов_ (_type inference_) в Scala часто заставляет язык чувствовать себя динамически типизированным, даже если он статически типизирован.
75+
Это верно для объявления переменной:
7376

7477
{% tabs dynamic %}
7578
{% tab 'Scala 2 and 3' for=dynamic %}
@@ -82,7 +85,7 @@ val stuff = ("fish", 42, 1_234.5)
8285
{% endtab %}
8386
{% endtabs %}
8487

85-
It’s also true when passing anonymous functions to higher-order functions:
88+
Это также верно при передаче анонимных функций функциям высшего порядка:
8689

8790
{% tabs dynamic-hof %}
8891
{% tab 'Scala 2 and 3' for=dynamic-hof %}
@@ -95,7 +98,7 @@ list.filter(_ < 4)
9598
{% endtab %}
9699
{% endtabs %}
97100

98-
and when defining methods:
101+
и при определении методов:
99102

100103
{% tabs dynamic-method %}
101104
{% tab 'Scala 2 and 3' for=dynamic-method %}
@@ -105,27 +108,27 @@ def add(a: Int, b: Int) = a + b
105108
{% endtab %}
106109
{% endtabs %}
107110

108-
This is more true than ever in Scala 3, such as when using [union types][union-types]:
111+
Это как никогда верно для Scala 3, например, при использовании [типов объединения][union-types]:
109112

110113
{% tabs union %}
111114
{% tab 'Scala 3 Only' for=union %}
112115
```scala
113-
// union type parameter
116+
// параметр типа объединения
114117
def help(id: Username | Password) =
115118
val user = id match
116119
case Username(name) => lookupName(name)
117120
case Password(hash) => lookupPassword(hash)
118-
// more code here ...
121+
// дальнейший код ...
119122

120-
// union type value
123+
// значение типа объединения
121124
val b: Password | Username = if (true) name else password
122125
```
123126
{% endtab %}
124127
{% endtabs %}
125128

126-
## 3) Concise syntax
129+
## 3) Лаконичный синтаксис
127130

128-
Scala is a low ceremony, “concise but still readable” language. For instance, variable declaration is concise:
131+
Scala — это неформальный, “краткий, но все же читабельный“ язык. Например, объявление переменной лаконично:
129132

130133
{% tabs concise %}
131134
{% tab 'Scala 2 and 3' for=concise %}
@@ -137,7 +140,7 @@ val c = List(1,2,3)
137140
{% endtab %}
138141
{% endtabs %}
139142

140-
Creating types like traits, classes, and enumerations are concise:
143+
Создание типов, таких как трейты, классы и перечисления, является кратким:
141144

142145
{% tabs enum %}
143146
{% tab 'Scala 3 Only' for=enum %}
@@ -160,7 +163,7 @@ case class Person(
160163
{% endtab %}
161164
{% endtabs %}
162165

163-
Higher-order functions are concise:
166+
Функции высшего порядка кратки:
164167

165168
{% tabs list-hof %}
166169
{% tab 'Scala 2 and 3' for=list-hof %}
@@ -172,19 +175,21 @@ list.map(_ * 2)
172175
{% endtab %}
173176
{% endtabs %}
174177

175-
All of these expressions and many more are concise, and still very readable: what we call _expressive_.
178+
Все эти и многие другие выражения кратки и при этом очень удобочитаемы: то, что мы называем _выразительным_ (_expressive_).
176179

177-
## 4) Implicits, simplified
180+
## 4) Implicits, упрощение
178181

179-
Implicits in Scala 2 were a major distinguishing design feature.
180-
They represented _the_ fundamental way to abstract over context, with a unified paradigm that served a great variety of use cases, among them:
182+
Implicits в Scala 2 были главной отличительной особенностью дизайна.
183+
Они представляли собой фундаментальный способ абстрагирования от контекста с единой парадигмой,
184+
которая обслуживала множество вариантов использования, среди которых:
181185

182-
- Implementing [type classes]({% link _overviews/scala3-book/ca-type-classes.md %})
183-
- Establishing context
184-
- Dependency injection
185-
- Expressing capabilities
186+
- Реализация [типовых классов]({% link _overviews/scala3-book/ca-type-classes.md %})
187+
- Установление контекста
188+
- Внедрение зависимости
189+
- Выражение возможностей
186190

187-
Since then, other languages have adopted similar concepts, all of which are variants of the core idea of _term inference_: Given a type, the compiler synthesizes a “canonical” term that has that type.
191+
С тех пор другие языки приняли аналогичные концепции, все из которых являются вариантами основной идеи вывода терминов:
192+
при заданном типе компилятор синтезирует “канонический” термин, имеющий этот тип.
188193

189194
While implicits were a defining feature in Scala 2, their design has been greatly improved in Scala 3:
190195

0 commit comments

Comments
 (0)