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
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,13 +13,17 @@ This repo contains all the code examples in O'Reilly's [Programming Scala, Third
13
13
14
14
The `master` branch and the `3.X.Y` tag releases are for the third edition. The code examples for the second edition are still available. [Download the release tagged 2.1.0](https://github.com/deanwampler/programming-scala-book-code-examples/releases/tag/2.1.0) or check out the `release-2.1.0` branch. While the second edition was published for 2.11. The latest `2.1.0` release and `release-2.1.0` are updated for 2.12 and 2.13. (No more `release-2.X.Y` releases are planned.)
15
15
16
-
> **TIP:** Several sections offer troubleshooting tips if you encounter problems.
16
+
> [!WARNING]
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
+
> [!TIP]
20
+
> Several sections offer troubleshooting tips if you encounter problems.
17
21
18
22
## How the Code Is Used in the Book
19
23
20
24
In the book's text, when an example corresponds to a file in this distribution, the listing begins with a path in a comment with the following format:
21
25
22
-
```
26
+
```scala
23
27
// src/main/scala/progscala3/.../FooBar.scala
24
28
```
25
29
@@ -44,7 +48,7 @@ You won't find many comments in the code, except of the form `// <1>`, which get
44
48
45
49
Some files have sections marked like this:
46
50
47
-
```
51
+
```scala
48
52
// tag::section1[]
49
53
// end::section1[]
50
54
```
@@ -61,7 +65,7 @@ If you want to install Scala separately and Scala's *Scaladocs*, go to the [scal
61
65
62
66
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:
63
67
64
-
```
68
+
```shell
65
69
$ $SPARK_HOME/bin/spark-shell
66
70
...
67
71
scala>
@@ -133,7 +137,7 @@ The `~` prefix causes the task to be run continuously each time source code chan
133
137
134
138
Outside of `sbt`, you could, in principle, run the REPL and load the script files manually at the prompt:
135
139
136
-
```
140
+
```shell
137
141
$ scala
138
142
scala> :load src/script/scala/.../Foo.scala
139
143
```
@@ -142,7 +146,7 @@ However, it's easier to run most of the scripts using `sbt console`, because `sb
142
146
143
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:
0 commit comments