Skip to content

Commit 96b0971

Browse files
committed
Updates to the README adn .gitignore for Scala 3.5.0 CLI behavior.
Signed-off-by: Dean Wampler <dean.wampler@ibm.com>
1 parent d414fdb commit 96b0971

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ project/metals.sbt
2626
.bsp/
2727
src/worksheet/
2828
coverage/
29+
.scala-build/

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,23 +135,26 @@ tasks -V # REALLY show ALL tasks
135135

136136
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!
137137

138-
Outside of `sbt`, you could, in principle, run the REPL and load the script files manually at the prompt:
138+
Outside of `sbt`, you could, in principle, run the REPL and load the script files manually at the prompt, for example:
139139

140140
```shell
141141
$ scala
142-
scala> :load src/script/scala/.../Foo.scala
142+
scala> :load src/script/scala/progscala3/introscala/Upper1.scala
143143
```
144144

145145
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.
146146

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:
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, for example:
148148

149149
```shell
150-
$ scala src/main/scala/progscala3/introscala/UpperMain2.scala Hello World!
150+
$ scala src/main/scala/progscala3/introscala/UpperMain2.scala -- Hello World!
151151
HELLO WORLD!
152152
$
153153
```
154154

155+
> [!NOTE]
156+
> The `--` argument separator is required for Scala 3.5.0 and later. It is not used for Scala 3.4.X and earlier.
157+
155158
## Feedback
156159

157160
I welcome feedback on the Book and these examples. Please post comments, corrections, etc. to one of the following places:
@@ -178,5 +181,6 @@ There is also my dedicated site for the book where occasional updates, clarifica
178181
| May 22, 2021 | _Final_ updates for _Programming Scala, Third Edition_! |
179182
| July 24, 2021 | Scala 3.0.1. Notes on using IntelliJ. |
180183
| 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)). |
184+
| September 15, 2024 | Scala 3.5.0 changes, e.g. the [new Scala CLI](https://docs.scala-lang.org/sips/scala-cli.html). |
181185

182186

0 commit comments

Comments
 (0)