Skip to content

Commit

Permalink
Merge branch 'main' into getting-started
Browse files Browse the repository at this point in the history
# Conflicts:
#	_config.yml
#	api/all.md
  • Loading branch information
gkepka committed Oct 16, 2024
2 parents 8e84db6 + 15b3f6f commit 57efc0e
Show file tree
Hide file tree
Showing 78 changed files with 4,837 additions and 177 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.6)
strscan
rouge (3.30.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
Expand Down
4 changes: 2 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ keywords:
- Document
- Guide

scala-version: 2.13.14
scala-212-version: 2.12.19
scala-version: 2.13.15
scala-212-version: 2.12.20
scala-3-version: 3.5.1

collections:
Expand Down
4 changes: 0 additions & 4 deletions _data/compiler-options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,6 @@
schema:
type: "Boolean"
description: "Don't perform exhaustivity/unreachability analysis. Also, ignore @switch annotation."
- option: "-Xno-uescape"
schema:
type: "Boolean"
description: "Disable handling of \\u unicode escapes."
- option: "-Xnojline"
schema:
type: "Boolean"
Expand Down
7 changes: 6 additions & 1 deletion _data/doc-nav-header.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
- title: Getting Started
url: "/getting-started/index.html"
url: "#"
submenu:
- title: Install Scala
url: "/getting-started/install-scala.html"
- title: Scala IDEs
url: "/getting-started/scala-ides.html"
- title: Scala 3
url: "#"
submenu:
Expand Down
3 changes: 3 additions & 0 deletions _data/overviews.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@
description: "A diverse and comprehensive set of libraries is important to any productive software ecosystem. While it is easy to develop and distribute Scala libraries, good library authorship goes beyond just writing code and publishing it. In this guide, we cover the important topic of Binary Compatibility."
icon: puzzle-piece
url: "core/binary-compatibility-for-library-authors.html"
- title: Nightly Versions of Scala
description: "We regularly publish 'nightlies' of both Scala 3 and Scala 2 so that users can preview and test the contents of upcoming releases. Here's how to find and use these versions."
url: "core/nightlies.html"

- category: "Tools"
description: "Reference material on core Scala tools like the Scala REPL and Scaladoc generation."
Expand Down
2 changes: 1 addition & 1 deletion _data/setup-scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ linux-x86-64: curl -fL https://github.com/coursier/coursier/releases/latest/down
linux-arm64: curl -fL https://github.com/VirtusLab/coursier-m1/releases/latest/download/cs-aarch64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setup
macOS-x86-64: curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-apple-darwin.gz | gzip -d > cs && chmod +x cs && (xattr -d com.apple.quarantine cs || true) && ./cs setup
macOS-arm64: curl -fL https://github.com/VirtusLab/coursier-m1/releases/latest/download/cs-aarch64-apple-darwin.gz | gzip -d > cs && chmod +x cs && (xattr -d com.apple.quarantine cs || true) && ./cs setup
macOS-brew: brew install coursier/formulas/coursier && cs setup
macOS-brew: brew install coursier && coursier setup
windows-link: https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-win32.zip
37 changes: 37 additions & 0 deletions _includes/_markdown/install-cask.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{% altDetails require-info-box 'Getting Cask' %}

{% tabs cask-install class=tabs-build-tool %}

{% tab 'Scala CLI' %}
You can declare a dependency on Cask with the following `using` directive:
```scala
//> using dep "com.lihaoyi::cask::0.9.2"
```
{% endtab %}

{% tab 'sbt' %}
In your `build.sbt`, you can add a dependency on Cask:
```scala
lazy val example = project.in(file("example"))
.settings(
scalaVersion := "3.4.2",
libraryDependencies += "com.lihaoyi" %% "cask" % "0.9.2",
fork := true
)
```
{% endtab %}

{% tab 'Mill' %}
In your `build.sc`, you can add a dependency on Cask:
```scala
object example extends RootModule with ScalaModule {
def scalaVersion = "3.3.3"
def ivyDeps = Agg(
ivy"com.lihaoyi::cask::0.9.2"
)
}
```
{% endtab %}

{% endtabs %}
{% endaltDetails %}
5 changes: 3 additions & 2 deletions _includes/_markdown/install-munit.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ Alternatively, you can require just a specific version of MUnit:
{% tab 'sbt' %}
In your build.sbt file, you can add the dependency on toolkit-test:
```scala
lazy val example = project.in(file("example"))
lazy val example = project.in(file("."))
.settings(
scalaVersion := "3.3.3",
libraryDependencies += "org.scala-lang" %% "toolkit-test" % "0.1.7" % Test
)
```
Here the `Test` configuration means that the dependency is only used by the source files in `example/src/test`.

Here the `Test` configuration means that the dependency is only used by the source files in `src/test`.

Alternatively, you can require just a specific version of MUnit:
```scala
Expand Down
2 changes: 1 addition & 1 deletion _includes/_markdown/install-os-lib.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Alternatively, you can require just a specific version of OS-Lib:
{% tab 'sbt' %}
In your `build.sbt`, you can add a dependency on the toolkit:
```scala
lazy val example = project.in(file("example"))
lazy val example = project.in(file("."))
.settings(
scalaVersion := "3.3.3",
libraryDependencies += "org.scala-lang" %% "toolkit" % "0.1.7"
Expand Down
2 changes: 1 addition & 1 deletion _includes/_markdown/install-sttp.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Alternatively, you can require just a specific version of sttp:
{% tab 'sbt' %}
In your build.sbt file, you can add a dependency on the Toolkit:
```scala
lazy val example = project.in(file("example"))
lazy val example = project.in(file("."))
.settings(
scalaVersion := "3.3.3",
libraryDependencies += "org.scala-lang" %% "toolkit" % "0.1.7"
Expand Down
2 changes: 1 addition & 1 deletion _includes/_markdown/install-upickle.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Alternatively, you can require just a specific version of UPickle:
{% tab 'sbt' %}
In your build.sbt file, you can add the dependency on the Toolkit:
```scala
lazy val example = project.in(file("example"))
lazy val example = project.in(file("."))
.settings(
scalaVersion := "3.3.3",
libraryDependencies += "org.scala-lang" %% "toolkit" % "0.1.7"
Expand Down
2 changes: 1 addition & 1 deletion _ja/overviews/macros/paradise.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ title: マクロパラダイス
マクロパラダイス (Macro paradise) とは Scala の複数のバージョンをサポートするコンパイラプラグインで、一般向けにリリースされている <code>scalac</code> と共に正しく動作するように設計されている。
これによって、将来の Scala に取り込まれるよりもいち早く最新のマクロ機能を使えるようになっている。
[サポートされている機能とバージョンの一覧](/ja/overviews/macros/roadmap.html))に関してはロードマップページを、
動作の保証に関しては[マクロパラダイスのアナウンスメント](https://scalamacros.org/news/2013/08/07/roadmap-for-macro-paradise.html)を参照してほしい。
動作の保証に関しては[マクロパラダイスのアナウンスメント](hxxps://scalamacros.org/news/2013/08/07/roadmap-for-macro-paradise.html)を参照してほしい。

~/210x $ scalac -Xplugin:paradise_*.jar -Xshow-phases
phase name id description
Expand Down
2 changes: 1 addition & 1 deletion _ja/overviews/macros/typemacros.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: 型マクロ
**Eugene Yokota 訳**

型マクロ (type macro) は[マクロパラダイス](/ja/overviews/macros/paradise.html)の以前のバージョンから利用可能だったが、マクロパラダイス 2.0 ではサポートされなくなった。
[the paradise 2.0 announcement](https://scalamacros.org/news/2013/08/05/macro-paradise-2.0.0-snapshot.html) に説明と移行のための戦略が書かれている。
[the paradise 2.0 announcement](hxxps://scalamacros.org/news/2013/08/05/macro-paradise-2.0.0-snapshot.html) に説明と移行のための戦略が書かれている。

## 直観

Expand Down
2 changes: 1 addition & 1 deletion _ja/overviews/macros/untypedmacros.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: 型指定の無いマクロ
**Eugene Yokota 訳**

型指定の無いマクロ (untyped macro) は[マクロパラダイス](/ja/overviews/macros/paradise.html)の以前のバージョンから利用可能だったが、マクロパラダイス 2.0 ではサポートされなくなった。
[the paradise 2.0 announcement](https://scalamacros.org/news/2013/08/05/macro-paradise-2.0.0-snapshot.html) に説明と移行のための戦略が書かれている。
[the paradise 2.0 announcement](hxxps://scalamacros.org/news/2013/08/05/macro-paradise-2.0.0-snapshot.html) に説明と移行のための戦略が書かれている。

## 直観

Expand Down
4 changes: 2 additions & 2 deletions _ja/overviews/macros/usecases.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Scala の商用ユーザと研究ユーザの両方がマクロを利用して
ここ EPFL においても我々はマクロを活用して研究を行っている。Lightbend 社もマクロを数々のプロジェクトに採用している。
マクロはコミュニティー内でも人気があり、既にいくつかの興味深い応用が現れている。

最近行われた講演の ["What Are Macros Good For?"](https://scalamacros.org/paperstalks/2014-02-04-WhatAreMacrosGoodFor.pdf) では Scala 2.10 ユーザのマクロの利用方法を説明し、システム化した。講演の大筋はマクロはコード生成、静的な検査、および DSL に有効であるということで、これを研究や産業からの例を交えながら説明した。
最近行われた講演の ["What Are Macros Good For?"](https://github.com/scalamacros/scalamacros.github.com/blob/5904f7ef88a439c668204b4bf262835e89fb13cb/paperstalks/2014-02-04-WhatAreMacrosGoodFor.pdf) では Scala 2.10 ユーザのマクロの利用方法を説明し、システム化した。講演の大筋はマクロはコード生成、静的な検査、および DSL に有効であるということで、これを研究や産業からの例を交えながら説明した。

Scala'13 ワークショップにおいて ["Scala Macros: Let Our Powers Combine!"](https://scalamacros.org/paperstalks/2013-04-22-LetOurPowersCombine.pdf) という論文を発表した。これは Scala 2.10 における最先端のマクロ論をより学問的な視点から説明した。
Scala'13 ワークショップにおいて ["Scala Macros: Let Our Powers Combine!"](https://github.com/scalamacros/scalamacros.github.com/blob/5904f7ef88a439c668204b4bf262835e89fb13cb/paperstalks/2013-04-22-LetOurPowersCombine.pdf) という論文を発表した。これは Scala 2.10 における最先端のマクロ論をより学問的な視点から説明した。
この論文では Scala のリッチな構文と静的な型がマクロと相乗することを示し、また既存の言語機能をマクロによって新しい方法で活用できることを考察する。
2 changes: 1 addition & 1 deletion _ja/overviews/reflection/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Scala コンパイラが持つ型情報を全ては入手できない可能性

上の例では、まず `scala.reflect.runtime.universe` をインポートして
(型タグを使うためには必ずインポートされる必要がある)、`l` という名前の `List[Int]` を作る。
次に、context bound を持った型パラメータ `T` を持つ `getTypeTag` というメソッドは定義する
次に、context bound を持った型パラメータ `T` を持つ `getTypeTag` というメソッドを定義する
(REPL が示すとおり、これは暗黙の evidence パラメータを定義することに等価であり、コンパイラは `T` に対する型タグを生成する)。
最後に、このメソッドに `l` を渡して呼び出し、`TypeTag` に格納される型を返す `tpe` を呼び出す。
見ての通り、正しい完全な型 (つまり、`List` の具象型引数を含むということ) である `List[Int]` が返ってきた。
Expand Down
13 changes: 11 additions & 2 deletions _overviews/FAQ/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,15 @@ for multiple reasons, most notoriously
For an in-depth treatment of types vs. classes, see the blog post
["There are more types than classes"](https://typelevel.org/blog/2017/02/13/more-types-than-classes.html).

### Should I declare my parameterless method with or without parentheses?

In other words, should one write `def foo()` or just `def foo`?

Answer: by convention, the former is used to indicate that a method
has side effects.

For more details, see the Scala Style Guide, [here](https://docs.scala-lang.org/style/naming-conventions.html#parentheses).

### How can a method in a superclass return a value of the “current” type?

First, note that using `this.type` won't work. People often try that,
Expand Down Expand Up @@ -332,14 +341,14 @@ setting in a multi-project build.

For example, if you add this to your `build.sbt`:

scalaVersion := "2.13.14"
scalaVersion := "2.13.15"

that's a "bare" setting, and you might expect it to apply build-wide.
But it doesn't. _It only applies to the root project._

In many cases one should instead write:

ThisBuild / scalaVersion := "2.13.14"
ThisBuild / scalaVersion := "2.13.15"

Other possibilities include:

Expand Down
4 changes: 2 additions & 2 deletions _overviews/collections-2.13/maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ Immutable maps support in addition operations to add and remove mappings by retu
| **Additions and Updates:**| |
| `ms.updated(k, v)`<br>or `ms + (k -> v)` |The map containing all mappings of `ms` as well as the mapping `k -> v` from key `k` to value `v`.|
| **Removals:** | |
| `ms.remove(k)`<br>or `ms - k` |The map containing all mappings of `ms` except for any mapping of key `k`.|
| `ms.removeAll(ks)`<br>or `ms -- ks` |The map containing all mappings of `ms` except for any mapping with a key in `ks`.|
| `ms.removed(k)`<br>or `ms - k` |The map containing all mappings of `ms` except for any mapping of key `k`.|
| `ms.removedAll(ks)`<br>or `ms -- ks` |The map containing all mappings of `ms` except for any mapping with a key in `ks`.|

Mutable maps support in addition the operations summarized in the following table.

Expand Down
2 changes: 1 addition & 1 deletion _overviews/collections-2.13/trait-iterable.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ res7: List[Int] = List(3, 4, 5)
| `xs.count(p)` |The number of elements in `xs` that satisfy the predicate `p`.|
| **Folds:** | |
| `xs.foldLeft(z)(op)` |Apply binary operation `op` between successive elements of `xs`, going left to right and starting with `z`.|
| `xs.foldRight(z)(op)` |Apply binary operation `op` between successive elements of `xs`, going right to left and ending with `z`.|
| `xs.foldRight(z)(op)` |Apply binary operation `op` between successive elements of `xs`, going right to left and starting with `z`.|
| `xs.reduceLeft(op)` |Apply binary operation `op` between successive elements of non-empty collection `xs`, going left to right.|
| `xs.reduceRight(op)` |Apply binary operation `op` between successive elements of non-empty collection `xs`, going right to left.|
| **Specific Folds:** | |
Expand Down
2 changes: 1 addition & 1 deletion _overviews/contribute/bug-reporting-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ If you cannot find your issue in the issue tracker, create a new bug. The detail

Please make sure to fill in as many fields as possible. Make sure you've indicated the following:

1. **Exact Scala version** that you are using. For example, `2.13.14` or `3.3.3`. If the bug happens in multiple versions indicate all of them.
1. **Exact Scala version** that you are using. For example, `2.13.15` or `3.3.3`. If the bug happens in multiple versions indicate all of them.
2. **The component** that is affected by the bug. For example, the Standard Library, Scaladoc, etc.
3. **Labels** related to your issue. For example, if you think your issue is related to the typechecker, and if you have successfully minimized your issue, label your bug as "typechecker" and "minimized". Issue tracker will suggest names for existing labels as you type them so try not to create duplicates.
4. **Running environment**. Are you running on Linux? Windows? What JVM version are you using?
Expand Down
2 changes: 1 addition & 1 deletion _overviews/contribute/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ This is the impatient developer's checklist for the steps to submit a bug-fix pu
5. [Fix the bug, or implement the new small feature][hackers-implement], include new tests (yes, for bug fixes too).
6. [Test, rinse][hackers-test] and [test some more][partest-guide] until [all the tests pass][hackers-verify].
7. [Commit your changes][hackers-commit] to your feature branch in your fork. Please choose your commit message based on the [Git Hygiene](https://github.com/scala/scala#user-content-git-hygiene) section of the Scala project README.
8. If necessary [re-write git history](https://git-scm.com/book/en/Git-Branching-Rebasing) so that [commits are organized by major steps to the fix/feature](
8. If necessary [re-write git history](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) so that [commits are organized by major steps to the fix/feature](
https://github.com/scala/scala#git-hygiene). For bug fixes, a single commit is requested, for features several commits may be desirable (but each separate commit must compile and pass all tests)
9. [Submit a pull request][hackers-submit].
10. [Work with a reviewer](https://github.com/scala/scala#reviewing) to [get your pull request merged in][hackers-review].
Expand Down
8 changes: 4 additions & 4 deletions _overviews/contribute/hacker-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Hacking Scala begins with creating a branch for your work item. To develop Scala
and [GitHub](https://github.com/). This section of the guide provides a short walkthrough, but if you are new to Git,
it probably makes sense to familiarize yourself with Git first. We recommend

* the [Git Pro](https://git-scm.com/book/en/) online book.
* the [Git Pro](https://git-scm.com/book/en/v2) online book.
* the help page on [Forking a Git Repository](https://help.github.com/articles/fork-a-repo).
* this great training tool [LearnGitBranching](https://pcottle.github.io/learnGitBranching/). One-hour hands-on training helps more than 1000 hours reading.

Expand Down Expand Up @@ -96,7 +96,7 @@ Since in our example, we're going to fix an existing bug
16:39 ~/Projects/scala (master)$ git checkout -b ticket/6725
Switched to a new branch 'ticket/6725'

If you are new to Git and branching, read the [Branching Chapter](https://git-scm.com/book/en/Git-Branching) in the Git Pro book.
If you are new to Git and branching, read the [Branching Chapter](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell) in the Git Pro book.

### Build

Expand Down Expand Up @@ -333,11 +333,11 @@ Let's go into each of these points in more detail.

### Commit

The [Git Basics](https://git-scm.com/book/en/Git-Basics) chapter in the Git online book covers most of the basic workflow during this stage.
The [Git Basics](https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository) chapter in the Git online book covers most of the basic workflow during this stage.
There are two things you should know here:

1. Commit messages are often the only way to understand the intentions of authors of code written a few years ago. Thus, writing a quality is of utmost importance. The more context you provide for the change you've introduced, the larger the chance that some future maintainer understand your intentions. Consult [the pull request policies](https://github.com/scala/scala/blob/2.12.x/CONTRIBUTING.md) for more information about the desired style of your commits.
2. Keeping Scala's git history clean is also important. Therefore we won't accept pull requests for bug fixes that have more than one commit. For features, it is okay to have several commits, but all tests need to pass after every single commit. To clean up your commit structure, you want to [rewrite history](https://git-scm.com/book/en/Git-Branching-Rebasing) using `git rebase` so that your commits are against the latest revision of `master`.
2. Keeping Scala's git history clean is also important. Therefore we won't accept pull requests for bug fixes that have more than one commit. For features, it is okay to have several commits, but all tests need to pass after every single commit. To clean up your commit structure, you want to [rewrite history](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) using `git rebase` so that your commits are against the latest revision of `master`.

Once you are satisfied with your work, synced with `master` and cleaned up your commits you are ready to submit a patch to the central Scala repository. Before proceeding make sure you have pushed all of your local changes to your fork on GitHub.

Expand Down
Loading

0 comments on commit 57efc0e

Please sign in to comment.