Skip to content

Commit

Permalink
Remove all references to unsupported rewrite rules
Browse files Browse the repository at this point in the history
  • Loading branch information
johnduffell committed Dec 13, 2023
1 parent a815e66 commit 750bcf6
Show file tree
Hide file tree
Showing 61 changed files with 2,195 additions and 109 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ruby:3.0.5

RUN gem install bundler:2.4.7
RUN gem install bundler:2.4.21

WORKDIR /srv/jekyll

Expand Down
3 changes: 2 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ GEM

PLATFORMS
arm64-darwin-22
arm64-darwin-23
x64-mingw-ucrt
x86_64-linux

Expand All @@ -277,4 +278,4 @@ DEPENDENCIES
webrick

BUNDLED WITH
2.4.7
2.4.21
23 changes: 23 additions & 0 deletions _books/3-scala-for-the-impatient.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: "Scala for the Impatient"
link: https://horstmann.com/scala/
image: /resources/img/books/scala_for_the_impatient.jpg
status: Updated for Scala 3
authors: ["Cay Horstmann"]
publisher: Addison-Wesley Professional
publisherLink: https://www.oreilly.com/publisher/addison-wesley-professional/
---

What you get:

* Up to date coverage of Scala 3
* A rapid introduction to Scala for programmers who are competent in another language such as Java, C#, Python, JavaScript, or C++
* Blog-length chunks of information that you can digest quickly
* An organization that you'll find useful as a quick reference

What you don't get:

* An introduction into programming or object-oriented design
* Religion about the superiority of one paradigm or another
* Cute or academic examples
* Mind-numbing details about syntax minutiae
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
---
title: "Functional Programming in Scala"
link: https://www.manning.com/books/functional-programming-in-scala
image: /resources/img/books/FPiS_93x116.png
status: Covers Scala 2; Scala 3 version in early-access
authors: ["Paul Chiusano", "Rúnar Bjarnason"]
link: https://www.manning.com/books/functional-programming-in-scala-second-edition
image: /resources/img/books/FPiS_93x116.jpg
status: Updated for Scala 3
authors: ["Michael Pilquist", "Paul Chiusano", "Rúnar Bjarnason"]
publisher: Manning
publisherLink: https://www.manning.com/
---

"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."

Foreword by Martin Odersky.

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.
Forewords by Daniel Spiewak and Martin Odersky.
2 changes: 1 addition & 1 deletion _includes/sidebar-toc-multipage-overview.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% assign pagetype = page.type %}
<div class="content-nav">
<div class="inner-box sidebar-toc-wrapper {% if pagetype %}book{% endif %}" style="">
<div class="inner-box sidebar-toc-wrapper" style="">
<h5 class="contents">Contents</h5>
{% if pagetype %}
<div class="inner-toc book" id="sidebar-toc">
Expand Down
4 changes: 4 additions & 0 deletions _layouts/sip-meeting-results.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@
{% endfor %}
</tbody>
</table>

<div>
{{content}}
</div>
16 changes: 16 additions & 0 deletions _overviews/FAQ/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,22 @@ be written using the `_` syntax.

See also [SLS 6.23.2](https://scala-lang.org/files/archive/spec/2.13/06-expressions.html#placeholder-syntax-for-anonymous-functions).

### Why couldn't Scala infer the correct type in my code?

It is difficult to generalize about type inference, because various features of the language
affect how your code is construed. There may be several ways to rewrite your code to make
the types fall out naturally.

The most straightforward workaround is to supply explicit types in your code.

That may involve specifying an explicit type to a definition, or a type argument to a method.

Type inference is greatly improved in Scala 3. If Scala 2 doesn't compile your code, it's worth trying with Scala 3.

Sometimes, using multiple parameter lists helps inference, as explained in [this section of the language tour](https://docs.scala-lang.org/tour/multiple-parameter-lists.html#drive-type-inference).

For common questions about type inference involving `toSet`, see the discussions on [this ticket](https://github.com/scala/bug/issues/7743) and a related [Q&A](https://stackoverflow.com/questions/5544536/in-scala-2-type-inference-fails-on-set-made-with-toset).

### Can I chain or nest implicit conversions?

Not really, but you can [make it work](https://stackoverflow.com/a/5332804).
Expand Down
2 changes: 1 addition & 1 deletion _overviews/compiler-options/optimizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The Scala compiler has included an inliner since version 2.0. Closure eliminatio

The optimizer was re-written for Scala 2.12 to become more reliable and powerful – and to side-step the spelling issue by calling the new flag `-opt`. This post describes how to use the optimizer in Scala 2.12 and 2.13: what it does, how it works, and what are its limitations.

The options were simplified for 2.13.9, as described here. The [earlier version](https://www.lightbend.com/blog/scala-inliner-optimizer) of this article uses the traditional forms, which are still supported.
The options were simplified for 2.13.9. This page uses the simplified forms.

## Motivation

Expand Down
60 changes: 44 additions & 16 deletions _overviews/jdk-compatibility/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,48 @@ title: JDK Compatibility
permalink: /overviews/jdk-compatibility/overview.html
---

Scala's primary platform is the Java Virtual Machine (JVM). (Other supported platforms: [Scala.js](https://www.scala-js.org/), [Scala Native](https://scala-native.readthedocs.io/).)
Scala's primary platform is the Java Virtual Machine (JVM). (Other supported platforms: [Scala.js](https://www.scala-js.org/), [Scala Native](https://scala-native.org/).)

Sometimes new JVM and JDK (Java Development Kit) versions require us to update Scala to remain compatible.

## Version compatibility table
## Scala compatibility table

| JDK version | Minimum Scala versions |
|:-----------:|:-------------------------------------------------------------|
| 21 (LTS) | 3.3.1, 2.13.11, 2.12.18 |
| 20 | 3.3.0, 2.13.11, 2.12.18 |
| 19 | 3.2.0, 2.13.9, 2.12.16 |
| 18 | 3.1.3, 2.13.7, 2.12.15 |
| 17 (LTS) | 3.0.0, 2.13.6, 2.12.15 |
| 11 (LTS) | 3.0.0, 2.13.0, 2.12.4, 2.11.12 |
| 8 (LTS) | 3.0.0, 2.13.0, 2.12.0, 2.11.0 |
Minimum Scala versions:

**Using latest patch version of Scala is always recommended**
| JDK | 3 | 2.13 | 2.12 | 2.11 |
|:-----------:|:--------:|:---------:|:---------:|:----------:|
| 22 (ea) | 3.3.2* | 2.13.12 | 2.12.19* | |
| 21 (LTS) | 3.3.1 | 2.13.11 | 2.12.18 | |
| 20 | 3.3.0 | 2.13.11 | 2.12.18 | |
| 17 (LTS) | 3.0.0 | 2.13.6 | 2.12.15 | |
| 11 (LTS) | 3.0.0 | 2.13.0 | 2.12.4 | 2.11.12 |
| 8 (LTS) | 3.0.0 | 2.13.0 | 2.12.0 | 2.11.0 |

Even when a version combination isn't listed as supported, most features may still work.
\* = forthcoming; support available in [nightly builds](https://stackoverflow.com/q/40622878/86485)

In general, Scala works on JDK 11+, including GraalVM, but may not take special advantage of features that were added after JDK 8. See [below](#jdk-11-compatibility-notes).
Even when a version combination isn't listed as supported, most features might still work.

Using latest patch version of Scala is always recommended.

Lightbend offers [commercial support](https://www.lightbend.com/lightbend-platform-subscription) for Scala 2. The linked page includes contact information for inquiring about supported and recommended versions.

## Build tool compatibility table

Minimum working versions:

| JDK | sbt | mill |
|:-----------:|:---------------:|:-----------|
| 21 (LTS) | 1.9.0 | 0.11.5 |
| 20 | 1.9.0 | 0.11.0 |
| 17 (LTS) | 1.6.0 | 0.7.0 |
| 11 (LTS) | 1.1.0 | 0.1.5 |
| 8 (LTS) | 1.0.0 | 0.1.0 |

Even when a version combination isn't listed as supported, most features might still work.

Using a different build tool, such as Gradle or Maven? We invite pull
requests adding additional columns to this table.

## Running versus compiling

JDK 8, 11, 17, and 21 are all reasonable choices both for *compiling* and *running* Scala code.
Expand Down Expand Up @@ -60,9 +78,9 @@ OpenJDK comes in various flavors, offered by different providers. We build and

The Scala test suite and Scala community build are green on JDK 11.

The Scala compiler does not enforce the restrictions of the Java Platform Module System, which means that code that typechecks may incur linkage errors at runtime. Scala 2.13.x will eventually provide [rudimentary support](https://github.com/scala/scala/pull/7218) for this (perhaps only in nightlies built on JDK 11).
In general, Scala works on JDK 11+, including GraalVM, but may not take special advantage of features that were added after JDK 8.

For sbt users, JDK 11 support requires minimum sbt version 1.1.0. sbt 1.3.9 or newer is recommended. (If you are still on the 0.13.x series, use 0.13.18.)
For example, the Scala compiler does not enforce the restrictions of the Java Platform Module System, which means that code that typechecks may incur linkage errors at runtime. Scala 2.13.x will eventually provide [rudimentary support](https://github.com/scala/scala/pull/7218) for this (perhaps only in nightlies built on JDK 11).

To track progress on JDK 11 related issues in Scala, watch:

Expand Down Expand Up @@ -93,6 +111,16 @@ For sbt users, sbt 1.9.0 is the first version to support JDK 21.

For possible Scala issues, see the [jdk11](https://github.com/scala/bug/labels/jdk11), [jdk17](https://github.com/scala/bug/labels/jdk17), and [jdk21](https://github.com/scala/bug/labels/jdk21) labels in the Scala 2 bug tracker.

## JDK 22 compatibility notes

Early access builds of JDK 22 are available. JDK 22 will be non-LTS.

Initial support for JDK 22 has been merged and is now available in
Scala 2.13.12.

We are working on adding JDK 22 support to the 2.12.x and 3.3.x
release series. (Support may be available in nightly builds.)

## GraalVM Native Image compatibility notes

There are several records of successfully using Scala with [GraalVM](https://www.graalvm.org) Native Image (i.e., ahead of time compiler) to produce directly executable binaries.
Expand Down
2 changes: 1 addition & 1 deletion _overviews/scala3-book/concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Concurrency
type: chapter
description: This page discusses how Scala concurrency works, with an emphasis on Scala Futures.
languages: [zh-cn]
languages: [ru, zh-cn]
num: 68
previous-page: ca-summary
next-page: scala-tools
Expand Down
2 changes: 1 addition & 1 deletion _overviews/scala3-book/scala-for-javascript-devs.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Also at a high level, some of the differences between JavaScript and Scala are:
- As a pure OOP language and a pure FP language, Scala encourages a fusion of OOP and FP, with functions for the logic and immutable objects for modularity
- Scala has state of the art, third-party, open source functional programming libraries
- Everything in Scala is an _expression_: constructs like `if` statements, `for` loops, `match` expressions, and even `try`/`catch` expressions all have return values
- The [Scala Native](https://scala-native.readthedocs.io/en/v0.3.9-docs) project lets you write “systems” level code, and also compiles to native executables
- The [Scala Native](https://scala-native.org/) project lets you write “systems” level code, and also compiles to native executables

### Programming level differences

Expand Down
2 changes: 1 addition & 1 deletion _overviews/scala3-book/scala-for-python-devs.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Also at a high level, the _differences_ between Python and Scala are:
- Though it’s statically typed, Scala features like type inference make it feel like a dynamic language
- Python is interpreted, and Scala code is compiled to _.class_ files, and runs on the Java Virtual Machine (JVM)
- In addition to running on the JVM, the [Scala.js](https://www.scala-js.org) project lets you use Scala as a JavaScript replacement
- The [Scala Native](https://scala-native.readthedocs.io/en/v0.3.9-docs) project lets you write “systems” level code, and compiles to native executables
- The [Scala Native](https://scala-native.org/) project lets you write “systems” level code, and compiles to native executables
- 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 variables and immutable collections
- Scala has excellent support for [concurrent and parallel programming][concurrency]
Expand Down
2 changes: 1 addition & 1 deletion _overviews/scala3-book/scala-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Scala Tools
type: chapter
description: This chapter looks at two commonly-used Scala tools, sbt and ScalaTest.
languages: [zh-cn]
languages: [ru, zh-cn]
num: 69
previous-page: concurrency
next-page: tools-sbt
Expand Down
2 changes: 1 addition & 1 deletion _overviews/scala3-book/tools-sbt.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Building and Testing Scala Projects with sbt
type: section
description: This section looks at a commonly-used build tool, sbt, and a testing library, ScalaTest.
languages: [zh-cn]
languages: [ru, zh-cn]
num: 70
previous-page: scala-tools
next-page: tools-worksheets
Expand Down
2 changes: 1 addition & 1 deletion _overviews/scala3-book/tools-worksheets.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Worksheets
type: section
description: This section looks at worksheets, an alternative to Scala projects.
languages: [zh-cn]
languages: [ru, zh-cn]
num: 71
previous-page: tools-sbt
next-page: interacting-with-java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The redesign of [contextual abstractions]({{ site.scala3ref }}/contextual) bring

|Incompatibility|Scala 2.13|Scala 3 Migration Rewrite|Scalafix Rule|Runtime Incompatibiltiy|
|--- |--- |--- |--- |--- |
|[Type of implicit def](#type-of-implicit-definition)|||[](https://github.com/ohze/scala-rewrites#fixexplicittypesexplicitimplicittypes)||
|[Type of implicit def](#type-of-implicit-definition)|||[](https://scalacenter.github.io/scalafix/docs/rules/ExplicitResultTypes.html)||
|[Implicit views](#implicit-views)||||**Possible**|
|[View bounds](#view-bounds)|Deprecation||||
|[Ambiguous conversion on `A` and `=> A`](#ambiguous-conversion-on-a-and--a)|||||
Expand All @@ -21,7 +21,7 @@ The redesign of [contextual abstractions]({{ site.scala3ref }}/contextual) bring
The type of implicit definitions (`val` or `def`) needs to be given explicitly in Scala 3.
They cannot be inferred anymore.

The Scalafix rule named `ExplicitImplicitTypes` in [ohze/scala-rewrites](https://github.com/ohze/scala-rewrites#fixexplicittypesexplicitimplicittypes) repository can write the missing type annotations automatically.
The Scalafix rule named [ExplicitResultTypes](https://scalacenter.github.io/scalafix/docs/rules/ExplicitResultTypes.html) can write the missing type annotations automatically.

## Implicit Views

Expand Down Expand Up @@ -147,4 +147,4 @@ implicit def lazyBoolFoo(lazyBool: => Boolean): Foo = ???

-true.foo()
+boolFoo(true).foo()
{% endhighlight %}
{% endhighlight %}
3 changes: 1 addition & 2 deletions _overviews/scala3-migration/incompat-syntactic.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ It is worth noting that most of the changes can be automatically handled during
|--- |--- |--- |--- |
|[Restricted keywords](#restricted-keywords)||||
|[Procedure syntax](#procedure-syntax)|Deprecation||[](https://scalacenter.github.io/scalafix/docs/rules/ProcedureSyntax.html)|
|[Parentheses around lambda parameter](#parentheses-around-lambda-parameter)|||[](https://github.com/ohze/scala-rewrites/tree/dotty/#fixscala213parensaroundlambda)|
|[Open brace indentation for passing an argument](#open-brace-indentation-for-passing-an-argument)||||
|[Parentheses around lambda parameter](#parentheses-around-lambda-parameter)|||||||
|[Wrong indentation](#wrong-indentation)||||
|[`_` as a type parameter](#_-as-a-type-parameter)||||
|[`+` and `-` as type parameters](#-and---as-type-parameters)||||
Expand Down
4 changes: 2 additions & 2 deletions _overviews/scala3-migration/incompatibility-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Some of the old syntax is not supported anymore.
|--- |--- |--- |--- |
|[Restricted keywords](incompat-syntactic.html#restricted-keywords)||||
|[Procedure syntax](incompat-syntactic.html#procedure-syntax)|Deprecation||[](https://scalacenter.github.io/scalafix/docs/rules/ProcedureSyntax.html)|
|[Parentheses around lambda parameter](incompat-syntactic.html#parentheses-around-lambda-parameter)|||[](https://github.com/ohze/scala-rewrites/tree/dotty/#fixscala213parensaroundlambda)|
|[Parentheses around lambda parameter](incompat-syntactic.html#parentheses-around-lambda-parameter)||||
|[Open brace indentation for passing an argument](incompat-syntactic.html#open-brace-indentation-for-passing-an-argument)||||
|[Wrong indentation](incompat-syntactic.html#wrong-indentation)||||
|[`_` as a type parameter](incompat-syntactic.html#_-as-a-type-parameter)||||
Expand All @@ -63,7 +63,7 @@ The redesign of [contextual abstractions]({{ site.scala3ref }}/contextual) bring

|Incompatibility|Scala 2.13|Scala 3 Migration Rewrite|Scalafix Rule|Runtime Incompatibility|
|--- |--- |--- |--- |--- |
|[Type of implicit def](incompat-contextual-abstractions.html#type-of-implicit-definition)|||[](https://github.com/ohze/scala-rewrites#fixexplicittypesexplicitimplicittypes)||
|[Type of implicit def](incompat-contextual-abstractions.html#type-of-implicit-definition)|||[](https://scalacenter.github.io/scalafix/docs/rules/ExplicitResultTypes.html)||
|[Implicit views](incompat-contextual-abstractions.html#implicit-views)||||**Possible**|
|[View bounds](incompat-contextual-abstractions.html#view-bounds)|Deprecation||||
|[Ambiguous conversion on `A` and `=> A`](incompat-contextual-abstractions.html#ambiguous-conversion-on-a-and--a)|||||
Expand Down
4 changes: 2 additions & 2 deletions _overviews/scala3-migration/scala3-migrate.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,11 @@ This command runs a number of Scalafix rules to patch some discarded syntax.

The list of applied Scalafix rules are:
- [ProcedureSyntax](https://scalacenter.github.io/scalafix/docs/rules/ProcedureSyntax.html)
- [fix.scala213.ConstructorProcedureSyntax](https://github.com/ohze/scala-rewrites/tree/dotty/#fixscala213constructorproceduresyntax)
- [fix.scala213.ExplicitNullaryEtaExpansion](https://github.com/lightbend-labs/scala-rewrites/blob/main/rewrites/src/main/scala/fix/scala213/ExplicitNullaryEtaExpansion.scala)
- [fix.scala213.ParensAroundLambda](https://github.com/ohze/scala-rewrites/tree/dotty/#fixscala213parensaroundlambda)
- [migrate.ParensAroundLambda](https://github.com/scalacenter/scala3-migrate/blob/ebb4a4087ed11899b9010f4c75eb365532694c0a/scalafix/rules/src/main/scala/migrate/ParensAroundParam.scala#L9)
- [fix.scala213.ExplicitNonNullaryApply](https://github.com/lightbend-labs/scala-rewrites/blob/main/rewrites/src/main/scala/fix/scala213/ExplicitNullaryEtaExpansion.scala)
- [fix.scala213.Any2StringAdd](https://github.com/lightbend-labs/scala-rewrites/blob/main/rewrites/src/main/scala/fix/scala213/Any2StringAdd.scala)
- [ExplicitResultTypes](https://scalacenter.github.io/scalafix/docs/rules/ExplicitResultTypes.html)

For more information about the syntax changes between Scala 2.13 and Scala 3, you can refer to [the Incompatibility Table](incompatibility-table.html).

Expand Down
1 change: 0 additions & 1 deletion _overviews/scala3-migration/tooling-tour.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ So far the relevant rules are:
- [Procedure Syntax](https://scalacenter.github.io/scalafix/docs/rules/ProcedureSyntax.html)
- [Explicit Result Types](https://scalacenter.github.io/scalafix/docs/rules/ExplicitResultTypes.html)
- Value Eta-Expansion: `fix.scala213.ExplicitNullaryEtaExpansion` in [scala/scala-rewrites](https://github.com/scala/scala-rewrites/blob/main/rewrites/src/main/scala/fix/scala213/ExplicitNullaryEtaExpansion.scala)
- Parentheses Around Lambda Parameter: `fix.scala213.ParensAroundLambda` in [ohze/scala-rewrites](https://github.com/ohze/scala-rewrites/blob/dotty/rewrites/src/main/scala/fix/scala213/ParensAroundLambda.scala)
- Auto Application: `fix.scala213.ExplicitNonNullaryApply` in [scala/scala-rewrites](https://github.com/scala/scala-rewrites/blob/main/rewrites/src/main/scala/fix/scala213/ExplicitNonNullaryApply.scala)
- `any2stringadd` Conversion: `fix.scala213.Any2StringAdd` in [scala/scala-rewrites](https://github.com/scala/scala-rewrites/blob/main/rewrites/src/main/scala/fix/scala213/Any2StringAdd.scala)

Expand Down
Loading

0 comments on commit 750bcf6

Please sign in to comment.