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
+12-16Lines changed: 12 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,17 +19,17 @@ The `master` branch and the `3.X.Y` tag releases are for the third edition. The
19
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
20
>
21
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.
30
+
> Note the required `--main-class` (or `-M`) flag before the “`main`” class `progscala3.introscala.Hello2` and the `--` to separate `scala` command arguments from your programs' arguments. Use these changes for all subsequent examples in the book that use the `scala` command to run code.
31
31
>
32
-
> It appears that `sbt` syntax has **not** changed when using `runMain` at the SBT prompt, for example:
32
+
> It appears that `sbt` syntax has **not** changed when using `runMain` at the SBT prompt. So, for example, the following still works as documented in the book:
Following the usual conventions, tests are in `src/test/...`.
50
50
51
-
Use these comments to find the corresponding source file. This archive also contains *MUnit* and *ScalaCheck* unit tests to validate some of the code.
51
+
Use these comments shown in the book to find the corresponding source file in the repo. The repo also contains *MUnit* and *ScalaCheck* unit tests to validate some of the code.
52
52
53
53
## Naming Conventions
54
54
@@ -76,13 +76,13 @@ These are used to mark sections that are selectively included in the book. Somet
76
76
77
77
## Required and Optional Tools
78
78
79
-
To build and run the examples, all you need is a recent version of the the JDK and [`sbt`](http://www.scala-sbt.org/release/docs/Getting-Started/Setup.html). When you run `sbt`, it will bootstrap itself with the correct version of its jar file, Scala, and project dependencies, which are specified in the `build.sbt` file in the root directory and other build files in the `project` directory.
79
+
To build and run the examples, all you need is a recent version of the the Java SDK and [`sbt`](http://www.scala-sbt.org/release/docs/Getting-Started/Setup.html). When you run `sbt`, it will bootstrap itself with the correct version of itself, Scala, and project dependencies, which are specified in the `build.sbt` file in the root directory and other build files in the `project` directory.
80
80
81
81
Follow these [`sbt` installation instructions](http://www.scala-sbt.org/release/docs/Getting-Started/Setup.html).
82
82
83
83
If you want to install Scala separately and Scala's *Scaladocs*, go to the [scala-lang.org _Getting Started_ guide](https://docs.scala-lang.org/scala3/getting-started.html) for details. However, this isn't required.
84
84
85
-
If you want to play with the Spark example, `src/script/scala-2/progscala3/bigdata/SparkWordCount.scala`, you'll need to download a Spark distribution from https://spark.apache.org. Assuming that `$SPARK_HOME` refers to the root directory of your Spark installation, run the following command in the root directory of this project:
85
+
If you want to play with the Spark example, `src/script/scala-2/progscala3/bigdata/SparkWordCount.scala`, you'll need to download a Spark distribution from [spark.apache.org](https://spark.apache.org). Assuming that `$SPARK_HOME` refers to the root directory of your Spark installation, run the following command in the root directory of this repo to start the Scala REPL with Spark enabled:
86
86
87
87
```shell
88
88
$ $SPARK_HOME/bin/spark-shell
@@ -96,9 +96,7 @@ Then copy and paste the content of `src/script/scala-2/progscala3/bigdata/SparkW
96
96
97
97
### Editors, IntelliJ, Visual Studio Code, and Other IDEs
98
98
99
-
> **NOTE:** Support for Scala 3 may be limited for a while in the following tools.
100
-
101
-
Most editors and IDEs now have some sort of Scala support:
99
+
Most editors and IDEs now have some sort of Scala 3 support, either "natively" or through optional plugins:
102
100
103
101
*[IntelliJ](https://www.jetbrains.com/idea/): Either the Community or Ultimate additions will work. Install the Scala plugin, which has built-in support for `sbt`.
104
102
*[Visual Studio Code](https://code.visualstudio.com/): Use the new [Scala Metals](https://scalameta.org/metals/) plugin instead of older plugins.
@@ -110,7 +108,7 @@ After installing the required plugins, load this project in your IDE, which shou
110
108
111
109
### Troubleshooting with IntelliJ
112
110
113
-
One reader reported a problem when trying to run examples in IntelliJ: `scalac: Flag -encoding set repeatedly`. I could confirm this problem and I fixed it as follows:
111
+
One reader reported a problem when trying to run examples in IntelliJ: `scalac: Flag -encoding set repeatedly`. I confirmed this problem (at the time; it may no longer be an issue...) and I fixed it as follows:
114
112
115
113
1. Open the preferences ("cmd-," on MacOS)
116
114
2. Search for "scala"
@@ -183,13 +181,13 @@ check-scripts.sh
183
181
check-mains.sh
184
182
```
185
183
186
-
Both have `--help` options to see what options they accept. Both do their best to check that the output is expected, but a complication is the fact that many of the Scala scripts and "mains" have deliberate errors for illustrative purposes. The `check-*.sh` scripts attempt to compensate for this, for example by knowing which scripts should fail and allowing them to fail "successfully", but to be _absolutely certain_they are running correctly, it is really necessary to visually inspect the saved output from the runs (as described in console output of the `check-*.sh`) to see if the behavior _looks_ correct.
184
+
Both have `--help` options to see what options they accept. Both do their best to check that the output is expected, but a complication is the fact that many of the Scala scripts and "mains" have deliberate errors for illustrative purposes. The `check-*.sh` scripts attempt to compensate for this, for example by knowing which scripts should fail and allowing them to fail "successfully", but to be _absolutely certain_all the examples are running correctly, it is really necessary to visually inspect the saved output from the runs (as described in console output of the `check-*.sh`) to see if the results _look_ correct.
187
185
188
186
## Feedback
189
187
190
188
I welcome feedback on the Book and these examples. Please post comments, corrections, etc. to one of the following places:
191
189
192
-
* This GitHub repo's [Discussion forum](https://github.com/deanwampler/programming-scala-book-code-examples/discussions), or [Issues](https://github.com/deanwampler/programming-scala-book-code-examples/issues).
190
+
* This GitHub repo's [discussion forum](https://github.com/deanwampler/programming-scala-book-code-examples/discussions) or [post an issue](https://github.com/deanwampler/programming-scala-book-code-examples/issues).
193
191
* The [O'Reilly book page](https://oreil.ly/programming-scala-3) and the [errata page](https://www.oreilly.com/catalog/errata.csp?isbn=9781492077893).
194
192
* Dean Wampler's [Bluesky](https://bsky.app/profile/deanwampler.bsky.social), [Mastodon](https://discuss.systems/@deanwampler), or [LinkedIn](https://www.linkedin.com/in/deanwampler/) accounts.
195
193
@@ -217,5 +215,3 @@ Some milestones (but probably not all of them...).
217
215
| December 21, 2024 | Scala 3.6.2 changes, supporting new syntax options. |
218
216
| June 17, 2025 | Scala 3.7.X breaking changes and fixed some old bugs in some of the "scripts". |
219
217
| September 20, 2025 | Scala 3.7.3 breaking changes. Yes, a "patch" release, but in fairness, triggered by my strict compiler flags. |
0 commit comments