You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-5Lines changed: 28 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,25 @@ The `master` branch and the `3.X.Y` tag releases are for the third edition. The
15
15
16
16
> [!WARNING]
17
17
> Scala 3 is evolving, as are the tools that support it. I try to keep the `main` branch up to date with the latest versions, including changing the examples as required to handle new and changed features (see, e.g., [issue #131](https://github.com/deanwampler/programming-scala-book-code-examples/issues/131)). Hence, sometimes an example (or how to run it) will be different from what you see in the book. So, if you are reading the book and want the examples exactly as they appear there, with the same tool versions used at that time, then grab the [`3.0.0-final`](https://github.com/deanwampler/programming-scala-book-code-examples/tree/3.0.0-final) release.
18
+
>
19
+
> In particular, running a scala program on the command line has changed as of 3.5.0. So, for example, at the top of page 12 of the book, change this command for running a program at the shell prompt:
20
+
>
21
+
> ```
22
+
> $ cp="target/scala-3.5.0/classes/" # Note the book has "3.0.0"
> Note the required `-M` (or `--main-class`) flag before the “`main`” class and the `--` to separate `scala` arguments from your programs arguments. Use these changes for all subsequent examples in the book that use the `scala` command to run code.
31
+
>
32
+
> It appears that `sbt` syntax has **not** changed when using `runMain` at the SBT prompt, for example:
Following the usual conventions, tests are in `src/test/...`.
@@ -135,23 +154,26 @@ tasks -V # REALLY show ALL tasks
135
154
136
155
The `~` prefix causes the task to be run continuously each time source code changes are saved. This promotes continuous TDD (test-driven development) and is one of my favorite features!
137
156
138
-
Outside of `sbt`, you could, in principle, run the REPL and load the script files manually at the prompt:
157
+
Outside of `sbt`, you could, in principle, run the REPL and load the script files manually at the prompt, for example:
However, it's easier to run most of the scripts using `sbt console`, because `sbt` will configure the `CLASSPATH` with the third-party libraries and compiled code examples that a script file might use.
146
165
147
-
Also, new for the Scala 3 REPL, for those `src/main/...` files that define one (and only one) _entry point_, meaning a `main` method (Scala 2 compatible) or annotated with `@main` (new Scala 3 technique), you can compile and run them in one step:
166
+
Also, new for the Scala 3 REPL, for those `src/main/...` files that define one (and only one) _entry point_, meaning a `main` method (Scala 2 compatible) or annotated with `@main` (new Scala 3 technique), you can compile and run them in one step, for example:
> The `--` argument separator is required for Scala 3.5.0 and later. It is not used for Scala 3.4.X and earlier.
176
+
155
177
## Feedback
156
178
157
179
I welcome feedback on the Book and these examples. Please post comments, corrections, etc. to one of the following places:
@@ -178,5 +200,6 @@ There is also my dedicated site for the book where occasional updates, clarifica
178
200
| May 22, 2021 |_Final_ updates for _Programming Scala, Third Edition_! |
179
201
| July 24, 2021 | Scala 3.0.1. Notes on using IntelliJ. |
180
202
| November 6, 2021 | Scala 3.1.0 and a fix for locale settings ([PR 42](https://github.com/deanwampler/programming-scala-book-code-examples/pull/42)). |
203
+
| September 15, 2024 | Scala 3.5.0 changes, e.g. the [new Scala CLI](https://docs.scala-lang.org/sips/scala-cli.html). |
0 commit comments