Skip to content

Commit a85e51e

Browse files
committed
Grammar fixes + Scala 3 version update
1 parent 0959275 commit a85e51e

File tree

7 files changed

+48
-47
lines changed

7 files changed

+48
-47
lines changed

_config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ keywords:
1717

1818
scala-version: 2.13.14
1919
scala-212-version: 2.12.19
20-
scala-3-version: 3.4.2
20+
scala-3-version: 3.5.1
2121

2222
collections:
2323
style:

_overviews/getting-started/index.md

+31-28
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ Run the following command in your terminal, following the on-screen instructions
100100
Check your setup with the command `scala -version`, which should output:
101101
```bash
102102
$ scala -version
103-
Scala code runner version {{site.scala-3-version}} -- Copyright 2002-2022, LAMP/EPFL
103+
Scala code runner version: 1.4.3
104+
Scala version (default): {{site.scala-3-version}}
104105
```
105106
{% endaltDetails %}
106107
<!-- end Alternative Detail -->
@@ -147,8 +148,10 @@ To install them manually:
147148
148149
## Using the Scala CLI
149150
150-
Create a file named `hello.scala` with the following code:
151+
In a directory of your choice, which we will call `<project-dir>`, create a file named `hello.scala` with the following code:
151152
```scala
153+
//> using scala {{site.scala-3-version}}
154+
152155
@main
153156
def hello(): Unit =
154157
println("Hello, World!")
@@ -159,19 +162,21 @@ the entry point in program execution. The method's type is `Unit`, which means i
159162
can be thought of as an analogue to the `void` keyword found in other languages. The `println` method will print the `"Hello, World!"`
160163
string to standard output.
161164

162-
To run the program, execute `scala run hello.scala` command. The file will be compiled and executed, with console output
165+
To run the program, execute `scala run hello.scala` command from a terminal, within the `<project-dir>` directory. The file will be compiled and executed, with console output
163166
similar to following:
164167
```
165168
$ scala run hello.scala
166-
Compiling project (Scala 3.5.0, JVM (20))
167-
Compiled project (Scala 3.5.0, JVM (20))
169+
Compiling project (Scala {{site.scala-3-version}}, JVM (20))
170+
Compiled project (Scala {{site.scala-3-version}}, JVM (20))
168171
Hello, World!
169172
```
170173

171174
### Handling command-line arguments
172175

173-
Let's rewrite the `hello.scala` file so that the program greets the person running it.
176+
Rewrite the `hello.scala` file so that the program greets the person running it.
174177
```scala
178+
//> using scala {{site.scala-3-version}}
179+
175180
@main
176181
def hello(name: String): Unit =
177182
println(s"Hello, $name!")
@@ -184,36 +189,37 @@ the content of the `name` argument.
184189
To pass the arguments when executing the program, put them after `--`:
185190
```
186191
$ scala run hello.scala -- Gabriel
187-
Compiling project (Scala 3.5.0, JVM (20))
188-
Compiled project (Scala 3.5.0, JVM (20))
192+
Compiling project (Scala {{site.scala-3-version}}, JVM (20))
193+
Compiled project (Scala {{site.scala-3-version}}, JVM (20))
189194
Hello, Gabriel!
190195
```
191196

192197
You can read more about [main methods](/scala3/book/methods-main-methods.html) and [string interpolation](/scala3/book/string-interpolation.html) in the Scala Book.
193198

194199
### Adding dependencies
195200

196-
Let's write a program that will count the files and directories present in its working directory. While in Scala you have full access to the Java API for
197-
filesystem interaction, the [os-lib](https://github.com/com-lihaoyi/os-lib) library by Li Haoyi is much more convenient to use. A dependency on the library can
198-
be added with the `//> using` directive. Put the following code in `counter.scala`.
201+
We now write a program that will count the files and directories present in its working directory.
202+
We use the [os-lib](https://github.com/com-lihaoyi/os-lib) library from the [Scala toolkit](toolkit/introduction.html)
203+
for that purpose. A dependency on the library can be added with the `//> using` directive. Put the following code in `counter.scala`.
199204
```scala
205+
//> using scala {{site.scala-3-version}}
200206
//> using dep "com.lihaoyi::os-lib:0.10.7"
201207

202208
@main
203209
def countFiles(): Unit =
204-
val paths = os.list(os.pwd)
205-
println(paths.length)
210+
val paths = os.list(os.pwd)
211+
println(paths.length)
206212
```
207213

208-
In the code above, the `os.pwd` returns the current working directory, which is then passed to `os.list`, which returns a sequence
209-
of paths directly within the directory passed as an argument. `val` is used to declare an immutable value, in this example storing the
214+
In the code above, `os.pwd` returns the current working directory. We pass it to `os.list`, which returns a sequence
215+
of paths directly within the directory passed as an argument. We use a `val` to declare an immutable value, in this example storing the
210216
sequence of paths.
211217

212218
Execute the program. The dependency will be automatically downloaded. The execution should result in a similar output:
213219
```
214220
$ scala run counter.scala
215-
Compiling project (Scala 3.5.0, JVM (20))
216-
Compiled project (Scala 3.5.0, JVM (20))
221+
Compiling project (Scala {{site.scala-3-version}}, JVM (20))
222+
Compiled project (Scala {{site.scala-3-version}}, JVM (20))
217223
4
218224
```
219225
The printed number should be 4: `hello.scala`, `counter.scala` and two hidden directories created automatically when a program is executed:
@@ -223,23 +229,23 @@ As it turns out, the `os-lib` library is a part of Scala Toolkit, a collection o
223229
operating system interaction or handling JSONs. You can read more about the libraries included in the toolkit [here](/toolkit/introduction.html).
224230
To include the toolkit libraries, use the `//> using toolkit default` directive:
225231
```scala
226-
//> using toolkit default
232+
//> using scala {{site.scala-3-version}}
233+
//> using toolkit 0.5.0
227234

228235
@main
229236
def countFiles(): Unit =
230-
val paths = os.list(os.pwd)
231-
println(paths.length)
237+
val paths = os.list(os.pwd)
238+
println(paths.length)
232239
```
233240

234-
This program is identical to the one above, with the only difference being that other toolkit libraries will also be available to use
235-
and their downloaded versions, instead of being specified by hand, will be the newest ones included in the toolkit.
241+
This program is identical to the one above. However, other toolkit libraries will also be available to use, should you need them.
236242

237-
### Using REPL
243+
### Using the REPL
238244

239-
You can execute code interactively using REPL provided by the `scala` command. Execute `scala` in console without any arguments.
245+
You can execute code interactively using the REPL provided by the `scala` command. Execute `scala` in the console without any arguments.
240246
```
241247
$ scala
242-
Welcome to Scala 3.5.0 (20-ea, Java OpenJDK 64-Bit Server VM).
248+
Welcome to Scala {{site.scala-3-version}} (20-ea, Java OpenJDK 64-Bit Server VM).
243249
Type in expressions for evaluation. Or try :help.
244250
245251
scala>
@@ -279,9 +285,6 @@ sbt and an IDE using the tutorials below. If you want to familiarize yourself wi
279285
* [The Tour of Scala](/tour/tour-of-scala.html) for bite-sized introductions to Scala's features.
280286
* [Learning Resources](/learn.html), which includes online interactive tutorials and courses.
281287
* [Our list of some popular Scala books](/books.html).
282-
* [The migration guide](/scala3/guides/migration/compatibility-intro.html) helps you to migrate your existing Scala 2 code base to Scala 3.
283-
284-
The [Scala CLI documentation](https://scala-cli.virtuslab.org/) describes the available sub-commands and how to integrate the tool with an IDE of choice.
285288

286289
## Create a "Hello World" project with sbt
287290

_overviews/scala3-book/taste-hello-world.md

+7-11
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,10 @@ Next, compile and run the code with `scala`:
5353
$ scala run hello.scala
5454
```
5555

56-
When you run the command for the first time, two hidden directories will be created: `.bsp` and `.scala-build`. The first
57-
one contains the [Build Server Protocol](https://build-server-protocol.github.io/) information for IDEs, and the second one contains the results
58-
of compilation.
59-
60-
The command should produce similar output:
56+
The command should produce an output similar to:
6157
```
62-
Compiling project (Scala 3.5.0, JVM (20))
63-
Compiled project (Scala 3.5.0, JVM (20))
58+
Compiling project (Scala {{site.scala-3-version}}, JVM (20))
59+
Compiled project (Scala {{site.scala-3-version}}, JVM (20))
6460
Hello, World!
6561
```
6662

@@ -131,8 +127,8 @@ and wait until you type a name and press return on the keyboard, looking like th
131127

132128
```bash
133129
$ scala run helloInteractive.scala
134-
Compiling project (Scala 3.5.0, JVM (20))
135-
Compiled project (Scala 3.5.0, JVM (20))
130+
Compiling project (Scala {{site.scala-3-version}}, JVM (20))
131+
Compiled project (Scala {{site.scala-3-version}}, JVM (20))
136132
Please enter your name:
137133
138134
```
@@ -141,8 +137,8 @@ When you enter your name at the prompt, the final interaction should look like t
141137

142138
```bash
143139
$ scala run helloInteractive.scala
144-
Compiling project (Scala 3.5.0, JVM (20))
145-
Compiled project (Scala 3.5.0, JVM (20))
140+
Compiling project (Scala {{site.scala-3-version}}, JVM (20))
141+
Compiled project (Scala {{site.scala-3-version}}, JVM (20))
146142
Please enter your name:
147143
Alvin Alexander
148144
Hello, Alvin Alexander!

_overviews/tutorials/scala-for-java-programmers.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ and should not be typed):
170170
```
171171

172172
The program will be automatically compiled (with compiled classes somewhere in the newly created `.scala-build` directory)
173-
and executed, producing a similar output:
173+
and executed, producing an output similar to:
174174
```
175-
Compiling project (Scala 3.5.0, JVM (20))
176-
Compiled project (Scala 3.5.0, JVM (20))
175+
Compiling project (Scala {{site.scala-3-version}}, JVM (20))
176+
Compiled project (Scala {{site.scala-3-version}}, JVM (20))
177177
Hello, World!
178178
```
179179

_ru/getting-started/index.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ newcomer_resources:
9090
Проверьте корректность установки с помощью команды `scala -version`, которая должна вывести:
9191
```bash
9292
$ scala -version
93-
Scala code runner version {{site.scala-3-version}} -- Copyright 2002-2022, LAMP/EPFL
93+
Scala code runner version: 1.4.3
94+
Scala version (default): {{site.scala-3-version}}
9495
```
9596
Если сообщение не выдано, возможно, необходимо перезайти в терминал (или перезагрузиться),
9697
чтобы изменения вступили в силу.

_uk/getting-started/index.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ _Scastie_ це онлайн “пісочниця”, де ви можете е
7575
Перевірте ваші налаштування виконавши команду `scala -version`, яка має вивести:
7676
```bash
7777
$ scala -version
78-
Scala code runner version {{site.scala-3-version}} -- Copyright 2002-2022, LAMP/EPFL
78+
Scala code runner version: 1.4.3
79+
Scala version (default): {{site.scala-3-version}}
7980
```
8081
Якщо це не спрацювало, необхідно завершити сеанс та зайти в систему знову (або перезавантажити), щоб зміни застосувались на вашій системі.
8182
{% endaltDetails %}

api/all.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ redirect_from:
88

99
## Latest releases
1010

11-
* Scala 3.4.2
12-
* [Library API](https://www.scala-lang.org/api/3.4.2/)
11+
* Scala {{site.scala-3-version}}
12+
* [Library API](https://www.scala-lang.org/api/{{site.scala-3-version}}/)
1313
* Scala 3.3.3 LTS
1414
* [Library API](https://www.scala-lang.org/api/3.3.3/)
1515
* Scala 2.13.14

0 commit comments

Comments
 (0)