Skip to content

Suggestions on the Scala 3 book (part 5) #2088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2021

Conversation

julienrf
Copy link
Contributor

Last batch of suggestions on the Scala 3 book!

@alvinj if you have some time to review, it would be great!

@julienrf julienrf requested a review from b-studios June 21, 2021 13:02
@julienrf julienrf force-pushed the scala3-book-suggestions-part5 branch from df9483d to f523c9a Compare June 21, 2021 13:07
Comment on lines -58 to +59
> While an actor may live forever, a future is intended to be run only once.
> While an actor may live forever, a future eventually contains the result
> of a computation that ran only once.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is important to not say things like “we run a Future” because that maintains a confusion on the purpose of Future (which only holds a future result, unlike a “task”, which is a computation that we can run, cancel, etc.)

Comment on lines +47 to +51
Create a file named _build.properties_ in the directory `project`, with
the following content:

```text
sbt.version=1.5.4
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it’s important to teach people to set the version of sbt, otherwise loading the build is undeterministic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good point!

@@ -49,6 +49,7 @@ Also at a high level, the differences between Java and Scala are:
- Scala has a full suite of immutable collections, including `List`, `Vector`, and immutable `Map` and `Set` implementations
- Everything in Scala is an _expression_: constructs like `if` statements, `for` loops, `match` expressions, and even `try`/`catch` expressions all have return values
- Scala idioms favor immutability by default: you’re encouraged to use immutable (`final`) variables and immutable collections
- Idiomatic Scala code does not use `null`, and thus does not suffer from `NullPointerException`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the comma is not necessary

@b-studios
Copy link
Contributor

Thanks @julienrf your changes look good to me. Maybe we can find a good solution to the for comprehension question above. Maybe I am just wrong :)

```


### Creating the build.sbt file
### Creating the build.properties and build.sbt files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I may need to look at this file when my brain is a little fresher, but at the moment it seems like I created a lot of ### headers under the ## Building Scala projects with sbt header, and today I find that confusing. I have another project I need to work on now, but if you’d like, I can look at this file again next week and see if it makes sense then, or reorganize it a little.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to reorganize if you think it makes sense 😊

IMHO, the structure looks good:
Screenshot from 2021-06-23 09-09-02

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, thanks. I just created a reminder to look at it next Wednesday.

@julienrf julienrf force-pushed the scala3-book-suggestions-part5 branch from bb1cf1e to 6241968 Compare June 23, 2021 07:25
@julienrf julienrf force-pushed the scala3-book-suggestions-part5 branch from e18da8b to 923bb72 Compare June 28, 2021 15:00
@julienrf julienrf merged commit fc9f2f5 into scala:main Jun 28, 2021
@julienrf julienrf deleted the scala3-book-suggestions-part5 branch June 28, 2021 15:07
@alvinj
Copy link
Contributor

alvinj commented Jul 1, 2021

@julienrf This looks much better to me this week. :) One question: What do you think about numbering the steps, like steps in a recipe? With that, the headers will look like this:

1) Create the project directory structure
2) Create the build.properties and build.sbt files
3) Create a Scala source code file
4) Create your first ScalaTest test

Personally I prefer this approach whenever there is a step-by-step process, but either way is fine.

@julienrf
Copy link
Contributor Author

julienrf commented Jul 1, 2021

I agree, that’s a good idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants