Skip to content

Commit 19d500a

Browse files
authored
Merge branch 'scala:main' into main
2 parents fb13d12 + 76a2ea9 commit 19d500a

37 files changed

+1328
-165
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
- name: Set up Ruby
99
uses: ruby/setup-ruby@v1
1010
with:
11-
ruby-version: 2.5.8
11+
ruby-version: 2.6.9
1212
bundler-cache: true
1313
- name: Set up coursier
1414
uses: coursier/[email protected]

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ruby:2.5
1+
FROM ruby:2.6
22

33
RUN gem install bundler jekyll
44

Gemfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ GEM
5454
rb-fsevent (~> 0.10, >= 0.10.3)
5555
rb-inotify (~> 0.9, >= 0.9.10)
5656
mercenary (0.3.6)
57-
mini_portile2 (2.6.1)
58-
nokogiri (1.12.5)
59-
mini_portile2 (~> 2.6.1)
57+
mini_portile2 (2.8.0)
58+
nokogiri (1.13.3)
59+
mini_portile2 (~> 2.8.0)
6060
racc (~> 1.4)
6161
nokogumbo (2.0.2)
6262
nokogiri (~> 1.8, >= 1.8.4)
6363
parallel (1.19.2)
6464
pathutil (0.16.2)
6565
forwardable-extended (~> 2.6)
6666
public_suffix (4.0.6)
67-
racc (1.5.2)
67+
racc (1.6.0)
6868
rainbow (3.0.0)
6969
rb-fsevent (0.11.0)
7070
rb-inotify (0.10.1)

_books/1-programming-in-scala-5th.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
title: "Programming in Scala, 5th ed"
33
link: https://www.artima.com/shop/programming_in_scala_5ed
44
image: /resources/img/books/ProgrammingInScala.png
5-
status: Updated for Scala 3.0
5+
status: Updated for Scala 3
66
authors: ["Martin Odersky", "Lex Spoon", "Bill Venners"]
7-
publisher:
7+
publisher: Artima
8+
publisherLink: https://www.artima.com/books
89
---
910

10-
(First edition [available for free online reading](https://www.artima.com/pins1ed/))
11-
1211
This book is co-authored by the language's designer, Martin Odersky. It provides depth and clarity on the diverse features of the language. The book provides both an authoritative reference for Scala and a systematic tutorial covering all the features in the language. Once you are familiar with the basics of Scala you will appreciate having this source of invaluable examples and precise explanations of Scala on hand. The book is available from [Artima](https://www.artima.com/shop/programming_in_scala_5ed). Award winning book - [Jolt Productivity award](https://www.drdobbs.com/joltawards/232601431) for Technical Books.

_books/5-functional-programming-in-scala.md renamed to _books/4-functional-programming-in-scala.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
title: "Functional Programming in Scala"
33
link: https://www.manning.com/books/functional-programming-in-scala
44
image: /resources/img/books/FPiS_93x116.png
5-
status: Available now
5+
status: Covers Scala 2; Scala 3 version in early-access
66
authors: ["Paul Chiusano", "Rúnar Bjarnason"]
77
publisher: Manning
88
publisherLink: https://www.manning.com/
99
---
1010

11-
"Functional programming (FP) is a style of software development emphasizing functions that don't depend on program state... Functional Programming in Scala is a serious tutorial for programmers looking to learn FP and apply it to the everyday business of coding. The book guides readers from basic techniques to advanced topics in a logical, concise, and clear progression. In it, you'll find concrete examples and exercises that open up the world of functional programming."
11+
"Functional programming (FP) is a style of software development emphasizing functions that don't depend on program state... Functional Programming in Scala is a serious tutorial for programmers looking to learn FP and apply it to the everyday business of coding. The book guides readers from basic techniques to advanced topics in a logical, concise, and clear progression. In it, you'll find concrete examples and exercises that open up the world of functional programming."
12+
13+
Foreword by Martin Odersky.
14+
15+
The [Scala 3 version](https://www.manning.com/books/functional-programming-in-scala-second-edition), co-authored by Michael Pilquist, is in early-access as of February 2022.

_books/5-get-programming.bd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: "Get Programming with Scala"
3+
link: https://www.manning.com/books/get-programming-with-scala
4+
image: /resources/img/books/get-programming-book.png
5+
status: Covers Scala 2 and 3
6+
authors: ["Daniela Sfregola"]
7+
publisher: Manning
8+
publisherLink: https://www.manning.com/
9+
---
10+
11+
"The perfect starting point for your journey into Scala and functional programming. Scala is a multi-style programming language for the JVM that supports both object-oriented and functional programming. Master Scala, and you'll be well-equipped to match your programming approach to the type of problem you're dealing with. Packed with examples and exercises, _Get Programming with Scala_ is the perfect starting point for developers with some OO knowledge who want to learn Scala and pick up a few FP skills along the way."
File renamed without changes.

_books/6-scala-puzzlers.bd

Lines changed: 0 additions & 11 deletions
This file was deleted.

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ keywords:
1717

1818
scala-version: 2.13.8
1919
scala-212-version: 2.12.15
20-
scala-3-version: 3.1.0
20+
scala-3-version: 3.1.1
2121

2222
collections:
2323
style:

_data/overviews.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@
259259
icon: cog
260260
url: "compiler-options/errors.html"
261261
description: "A new engine for more user-friendly error messages, printing chains of dependent implicits and colored found/required type diffs."
262+
- title: Optimizer
263+
by: Lukas Rytz and Andrew Marki
264+
icon: cog
265+
url: "compiler-options/optimizer.html"
266+
description: "The compiler can perform various optimizations."
262267

263268

264269
- category: Legacy

_includes/_ja/getting-started.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Scala をインストールすると、コンパイラやビルドツールな
1414

1515
### Scala インストーラーを使う(推奨)
1616

17-
Scala のインストーラーは[Coursier](https://get-coursier.io/docs/cli-overview)というツールで、コマンドは`cs`です。このツールを使うと、JVM と標準 Scala ツールがシステムにインストールされます。
17+
Scala のインストーラーは[Coursier](https://get-coursier.io/docs/cli-overview)というツールで、コマンドは`cs`です。このツールを使うと、JVM と標準 Scala ツールがシステムにインストールされます。
1818
以下の手順でお使いのシステムにインストールしてください。
1919

2020
<div class="main-download">
@@ -44,8 +44,8 @@ Scala のインストーラーは[Coursier](https://get-coursier.io/docs/cli-ove
4444
4545
### 手動でのインストール
4646
47-
Scala プロジェクトのコンパイル、実行、テスト、パッケージ化に必要なツールは Java と sbt の2つだけです。
48-
Java のバージョンは8または11です。
47+
Scala プロジェクトのコンパイル、実行、テスト、パッケージ化に必要なツールは Java と sbt の2つだけです。
48+
Java のバージョンは8または11です。
4949
これらを手動でインストールするには:
5050
5151
1. Java 8または11がインストールされていない場合は、[Oracle Java 8](https://www.oracle.com/java/technologies/javase-jdk8-downloads.html)、[Oracle Java 11](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html)、または[AdoptOpenJDK 8/11](https://adoptopenjdk.net/)からJavaをダウンロードしてください。Scala と Java の互換性の詳細については、[JDK Compatibility](/overviews/jdk-compatibility/overview.html)を参照してください。
@@ -144,13 +144,13 @@ Scala について日本語で質問したい場合、Twitterでつぶやくと
144144
145145
<!-- Hidden elements whose content are used to provide OS-specific download instructions.
146146
-- This is handled in `resources/js/functions.js`.
147-
-->
147+
-->
148148
<div style="display:none" id="stepOne-linux">
149-
<code class="hljs">$ curl -fLo cs https://git.io/coursier-cli-linux && chmod +x cs && ./cs setup </code> <br>
149+
<code class="hljs">$ curl -fL https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setup</code> <br>
150150
</div>
151151
152152
<div style="display:none" id="stepOne-unix">
153-
<p>Follow <a href="https://get-coursier.io/docs/cli-installation" target="_blank">the instructions to install the <code>cs</code> launcher</a> then run:</p>
153+
<p><a href="https://get-coursier.io/docs/cli-installation" target="_blank">手順に従って <code>cs</code> ランチャーをインストール</a>し、その次に以下を実行します。</p>
154154
<p><code>$ ./cs setup</code></p>
155155
</div>
156156
@@ -160,10 +160,10 @@ Scala について日本語で質問したい場合、Twitterでつぶやくと
160160
</div>
161161
<p>または、Homebrewを使用しない場合は</p>
162162
<div class="highlight">
163-
<code class="hljs">$ curl -fLo cs https://git.io/coursier-cli-macos && chmod +x cs && (xattr -d com.apple.quarantine cs || true) && ./cs setup</code> <br>
163+
<code class="hljs">$ curl -fL https://github.com/coursier/launchers/raw/master/cs-x86_64-apple-darwin.gz | gzip -d > cs && chmod +x cs && (xattr -d com.apple.quarantine cs || true) && ./cs setup</code> <br>
164164
</div>
165165
</div>
166166
167167
<div style="display:none" id="stepOne-windows">
168-
<p><a href="https://git.io/coursier-cli-windows-exe">the Scala installer for Windows</a>を、ダウンロードして実行すてください。</p>
168+
<p><a href="https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-win32.zip">the Scala installer for Windows</a>を、ダウンロードして実行してください。</p>
169169
</div>

_includes/getting-started.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,24 @@ Along with managing JVMs, `cs setup` also installs useful command-line tools:
3434
- The [sbt](https://www.scala-sbt.org/) build tool
3535
- [Ammonite](https://ammonite.io/), an enhanced REPL
3636
- [scalafmt](https://scalameta.org/scalafmt/), the Scala code formatter
37-
- `scalac` (the Scala 2 compiler)
38-
- `scala` (the Scala 2 REPL and script runner).
37+
- `scalac` (the Scala compiler)
38+
- `scala` (the Scala REPL and script runner).
3939

4040
For more information about `cs`, read
4141
[coursier-cli documentation](https://get-coursier.io/docs/cli-overview).
4242

43-
> Currently, `cs setup` installs the Scala 2 compiler and runner (the `scalac` and
44-
> `scala` commands, respectively). This is usually not an issue because most projects
45-
> use a build tool that works with both Scala 2 and Scala 3.
46-
> Nevertheless, you can install the Scala 3 compiler and runner as command-line tools
47-
> by running the following additional commands:
43+
> `cs setup` installs the Scala 3 compiler and runner by default (the `scalac` and
44+
> `scala` commands, respectively). Whether you intend to use Scala 2 or 3,
45+
> this is usually not an issue because most projects use a build tool that will
46+
> use the correct version of Scala irrespective of the one installed "globally".
47+
> Nevertheless, you can always launch a specific version of Scala using
4848
> ```
49-
> $ cs install scala3-compiler
50-
> $ cs install scala3
49+
> $ cs launch scala:{{ site.scala-version }}
50+
> $ cs launch scalac:{{ site.scala-version }}
51+
> ```
52+
> If you prefer Scala 2 to be run by default, you can force that version to be installed with:
53+
> ```
54+
> $ cs install scala:{{ site.scala-version }} scalac:{{ site.scala-version }}
5155
> ```
5256
5357
### ...or manually
@@ -164,9 +168,9 @@ There are a multitude of mailing lists and real-time chat rooms in case you want
164168
165169
<!-- Hidden elements whose content are used to provide OS-specific download instructions.
166170
-- This is handled in `resources/js/functions.js`.
167-
-->
171+
-->
168172
<div style="display:none" id="stepOne-linux">
169-
<code class="hljs">$ curl -fLo cs https://git.io/coursier-cli-linux && chmod +x cs && ./cs setup </code> <br>
173+
<code class="hljs">$ curl -fL https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setup</code><br>
170174
</div>
171175
172176
<div style="display:none" id="stepOne-unix">
@@ -180,10 +184,10 @@ There are a multitude of mailing lists and real-time chat rooms in case you want
180184
</div>
181185
<p>Alternatively, if you don't use Homebrew</p>
182186
<div class="highlight">
183-
<code class="hljs">$ curl -fLo cs https://git.io/coursier-cli-macos && chmod +x cs && (xattr -d com.apple.quarantine cs || true) && ./cs setup</code> <br>
187+
<code class="hljs">$ curl -fL https://github.com/coursier/launchers/raw/master/cs-x86_64-apple-darwin.gz | gzip -d > cs && chmod +x cs && (xattr -d com.apple.quarantine cs || true) && ./cs setup</code> <br>
184188
</div>
185189
</div>
186190
187191
<div style="display:none" id="stepOne-windows">
188-
<p>Download and execute <a href="https://git.io/coursier-cli-windows-exe">the Scala installer for Windows</a> based on coursier</p>
192+
<p>Download and execute <a href="https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-win32.zip">the Scala installer for Windows</a> based on coursier</p>
189193
</div>

_it/tutorials/scala-for-java-programmers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ definendo la classe `Date` come segue:
578578
def year = y
579579
def month = m
580580
def day = d
581-
override def toString(): String = year + "-" + month + "-" + day
581+
override def toString(): String = s"$year-$month-$day"
582582

583583
La parte importante qui è la dichiarazione `extends Ord` che segue il nome
584584
della classe e dei parametri. Dichiara che la classe `Date` eredita il

_ja/tour/type-inference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def squareOf(x: Int) = x * x
3232
def fac(n: Int) = if (n == 0) 1 else n * fac(n - 1)
3333
```
3434

35-
[ポリモーフフィックメソッド](polymorphic-methods.html)が呼ばれる時や[ジェネリッククラス](generic-classes.html) がインスタンス化される場合も型パラメータの指定は強制ではありません。Scalaコンパイラは文脈あるいはメソッドやコンストラクタの実際の引数から、指定されていない型パラメータを推論します。
35+
[ポリモーフィックメソッド](polymorphic-methods.html)が呼ばれる時や[ジェネリッククラス](generic-classes.html) がインスタンス化される場合も型パラメータの指定は強制ではありません。Scalaコンパイラは文脈あるいはメソッドやコンストラクタの実際の引数から、指定されていない型パラメータを推論します。
3636

3737
こちらは2つの例です。
3838

_ja/tutorials/scala-for-java-programmers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ Java の `Object` 型のより一般的なものとしてとらえられます
461461
def year = y
462462
def month = m
463463
def day = d
464-
override def toString(): String = year + "-" + month + "-" + day
464+
override def toString(): String = s"$year-$month-$day"
465465

466466
ここで重要なのは、クラス名とパラメータのあとに続く `extends Ord` という宣言です。
467467
`Date` クラスが `Ord` トレイトを継承していることを宣言しています。

_ko/tutorials/scala-for-java-programmers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ Java 프로그래머들이 트레잇을 이해하는 가장 쉬운 길은 코드
547547
def year = y
548548
def month = m
549549
def day = d
550-
override def toString(): String = year + "-" + month + "-" + day
550+
override def toString(): String = s"$year-$month-$day"
551551

552552
여기서 중요한 부분은 클래스 이름과 파라미터 뒤에 따라오는
553553
`extends Ord` 선언이다. 이 선언은 `Date` 클래스가 `Ord`

_overviews/FAQ/index.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,22 @@ get poor results, try surrounding the symbol with double quotes.
105105
sbt 1.x always uses Scala 2.12 to compile build definitions.
106106
Your sbt 1.x build definition is always a Scala 2.12 program.
107107

108-
Regardless, in your `build.sbt` you can set `scalaVersion` to anything
109-
you want and your actual program code will be compiled with that
110-
version.
108+
Regardless, in your `build.sbt`, you can set `scalaVersion` to whichever
109+
available distribution you want and your program code will be compiled with that version.
110+
111+
### I want Scala 3.1.1 (etc); why does std lib say it's using Scala 2.13?
112+
113+
Scala 3 currently uses the Scala 2.13 library by leveraging its seamless
114+
interoperability. Note that it does not necessarily ingest the latest
115+
version of the Scala 2.13 library.
116+
117+
```
118+
Welcome to Scala 3.1.1 (17.0.2, Java OpenJDK 64-Bit Server VM).
119+
Type in expressions for evaluation. Or try :help.
120+
121+
scala> util.Properties.versionString
122+
val res0: String = version 2.13.6
123+
```
111124

112125
### Why is my (abstract or overridden) `val` null?
113126

0 commit comments

Comments
 (0)