-
Notifications
You must be signed in to change notification settings - Fork 320
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
3.1 release blogpost #1284
Merged
Merged
3.1 release blogpost #1284
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
17437a4
Draft of 3.1 release blogpost
Kordyjan a5477d9
Apply some suggestions from code review
Kordyjan f021a91
Grammar fixes
Kordyjan a335e6b
Some clarifications in the 3.1 blogpost
Kordyjan 1b430cf
Add compatibility notice
Kordyjan 638f70f
Add point about unreductible match types raising error
Kordyjan c1ec919
Add contributors list
Kordyjan 31f3083
Update other files related to the 3.1.0 release
Kordyjan 30982b1
Add a paragraph about Mirrors for hierarchical sum types
Kordyjan 2509e8a
Update blog/_posts/2021-10-19-scala-3.1.0-released.md
Kordyjan 7ebcf45
Update blog/_posts/2021-10-19-scala-3.1.0-released.md
Kordyjan 37b52cc
Update blog/_posts/2021-10-19-scala-3.1.0-released.md
Kordyjan 5af7242
New Compatibility Notice
Kordyjan 4410b30
Update the publication date
Kordyjan 76d68d4
Two small clarifications
Kordyjan e0cdb31
Add stronger statement of our commitment
Kordyjan f20da70
Update blog/_posts/2021-10-21-scala-3.1.0-released.md
Kordyjan ba28464
Update blog/_posts/2021-10-21-scala-3.1.0-released.md
Kordyjan ec42953
Last clarifications
Kordyjan 8bc74a5
Apply suggestions from code review
Kordyjan c59eb20
Update blog/_posts/2021-10-21-scala-3.1.0-released.md
Kordyjan 0a7655f
Add note about versioning scheme
Kordyjan 48b9ece
Change `canThrow` to `throws`
Kordyjan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
title: Scala 3.1.0 | ||
start: 18 October 2021 | ||
layout: downloadpage | ||
release_version: 3.1.0 | ||
release_date: "October 18, 2021" | ||
permalink: /download/3.1.0.html | ||
license: <a href="https://www.scala-lang.org/license/">Apache License, Version 2.0</a> | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
--- | ||
layout: blog-detail | ||
post-type: blog | ||
by: Paweł Marks, VirtusLab | ||
title: Scala 3.1.0 released! | ||
--- | ||
|
||
Hello from the Scala 3 team! It has already been six weeks since we have announced the release candidate for the first minor version after the initial release of Scala 3. Now, after two more RCs, we can confidently promote Scala 3.1.0-RC3 to a new stable release of the language. In other words, Scala 3.1.0 is officially out! | ||
|
||
## Compatibility notice | ||
|
||
Scala 3 follows `major.minor.patch` versioning scheme (unlike Scala 2, which uses `epoch.major.minor`). This means that this is the first *minor* release after Scala 3.0.0. This has the following consequences: | ||
|
||
- Scala 3.1 is backward binary compatible: you can use dependencies compiled with Scala 3.0 in 3.1 projects. | ||
- Scala 3.1 is _not_ forward binary compatible: you _cannot_ use dependencies compiled with Scala 3.1 in Scala 3.0 projects. | ||
|
||
Although we cannot guarantee full source compatibility between minor versions, we have put a lot of effort into assuring that all code that was working in 3.0.2, except in some rare cases, will also work in 3.1.0. This means that if you are an application developer, you can confidently update the compiler version to take advantage of the newest improvements. You will still be able to use dependencies compiled with Scala 3.0. | ||
|
||
If you are a library maintainer, *updating to 3.1.0 will force all of your users to update to 3.1.0 as well*. We understand that the current state of binary compatibility may be unsatisfactory. We are actively working on technical solutions to support forward-compatibility in 3.2.0. In the meantime, we recommend testing your library with Scala 3.1.0 and 3.0.2, but _publishing_ it with 3.0.2. This will allow downstream users to use your library even if they can’t update to Scala 3.1.0. You can find an example of build that follows this recommendation [here](https://github.com/typelevel/scalacheck/pull/847). | ||
|
||
## What's new in 3.1 | ||
|
||
### New experimental feature: safer exceptions | ||
|
||
A new experimental feature that allows declaring and checking which exceptions can be thrown. It relies on the effects as implicit capabilities pattern. | ||
|
||
You can opt-in using the following import. | ||
|
||
```scala | ||
import language.experimental.saferExceptions | ||
``` | ||
|
||
Now it is possible to mark types with the type of exception that can be thrown during the evaluation: | ||
|
||
```scala | ||
def f(x: Double): Double throws LimitExceeded = | ||
if x < limit then f(x) else throw LimitExceeded() | ||
``` | ||
|
||
You can read more in [the document proposing this feature](https://github.com/lampepfl/dotty/blob/release-3.1.0/docs/docs/reference/experimental/canthrow.md). | ||
|
||
### Efficient bytecode for matching over strings | ||
|
||
Scala, since 3.0.0, has been able to optimize pattern matches with `Int` as a scrutinee type by emitting bytecode containing very efficient instructions: `lookupswitch` or `tableswitch`. | ||
Now in Scala 3.1, similar behavior was implemented for matching over `String` literals. | ||
|
||
```scala | ||
fruit match | ||
case "apple" => 1 | ||
case "orange" => 2 | ||
case "banana" => 3 | ||
case _ => 0 | ||
``` | ||
|
||
will now generate `lookupswitch` over hash codes of `String` literals instead of a chain of conditional expressions. This behavior is consistent with what Java does and more performant than the old approach. | ||
|
||
### Support for `-Wconf` and `@nowarn` | ||
|
||
We have added a `-Wconf` compiler flag that allows filtering and configuring compiler warnings (silence them, or turn them into errors). | ||
|
||
We have also brought back `@nowarn` annotation from Scala 2.13, originally inspired by [the silencer plugin](https://github.com/ghik/silencer). It can be used for suppressing warnings directly in the code, in the places where they are expected to occur. | ||
|
||
`-Wconf` and `@nowarn` work largely the same way as in Scala 2, but some filters for selecting warnings are different. For the more details see the output of `-Wconf:help` flag. | ||
|
||
### Simplified Manifest synthesis | ||
|
||
For the sake of compatibility with Scala 2, the Scala 3 compiler now generates given instances for the `Manifest` trait. The new implementation is a slightly simplified approximation of the Scala 2 implementation. It guarantees that any of the expressions: | ||
|
||
- `manifest[A] == manifest[B]` | ||
- `manifest[A].runtimeClass == manifest[B].runtimeClass` | ||
- `optManifest[A] == optManifest[B]` | ||
- `optManifest[A].asInstanceOf[ClassTag[A]].runtimeClass == optManifest[B].asInstanceOf[ClassTag[B]].runtimeClass` | ||
|
||
that were true in Scala 2, will also remain true when compiled with Scala 3. | ||
|
||
### Mirrors for Hierarchical Sealed Types | ||
|
||
Consider the following sealed hierarchy: | ||
|
||
```scala | ||
sealed trait Top | ||
case class Middle() extends Top with Bottom | ||
sealed trait Bottom extends Top | ||
``` | ||
|
||
Previously you would not be able to summon an instance of `scala.deriving.Mirror.SumOf` for `Top`, as its child `Bottom` is not a case class. In Scala 3.1 this is now possible, enabling compiletime reflection over nested hierarchies of sealed types. | ||
|
||
The only change necessary for users is that they should now consider that one of the `MirroredElemTypes` for a `Mirror.SumOf` could also be a sum type, not just product types. | ||
|
||
### Other changes | ||
|
||
- Scastie was integrated into Scaladoc to make snippets interactive. | ||
- `@experimental` annotation is no longer itself experimental. The users are no longer required to use a nightly build of the compiler to be able to define experimental APIs. See more detail in [the design document](https://github.com/lampepfl/dotty/blob/release-3.1.0/docs/docs/reference/other-new-features/experimental-defs.md) | ||
- Now `TastyInspector.{inspectTastyFiles, inspectTastyFilesInJar, inspectAllTastyFiles}` return a boolean value indicating whether the process succeeded | ||
- A `Wildcard` was made a subtype of `Ident` in the reflection API | ||
- `TypedOrTest` was added as a supertype of `Typed` in the reflection API | ||
- `Unapply.apply` was added to allow contruction of `Unapply` trees from macros | ||
- Unreductible match types now raise type errors | ||
- Scala 3.1 targets Scala.js 1.7.x+. This means that users must upgrade to Scala.js 1.7.0 or later to use Scala 3.1. | ||
|
||
Beside that Scala 3.1.0 introduced multiple small improvements and fixed a handful of bugs. You can see [the detailed changelog](https://github.com/lampepfl/dotty/releases/tag/3.1.0) on GitHub. | ||
|
||
## What's next | ||
|
||
During the Scala 3.1.0 stabilization period, which took the last six weeks, we haven't stopped improving the language and fixing the bugs in the compiler. You can already test the results of our work, using the published release candidate: Scala 3.1.1-RC1. [The full changelog](https://github.com/lampepfl/dotty/releases/tag/3.1.1-RC1) is as always available on GitHub. | ||
|
||
You can expect the stable release of Scala 3.1.1 in early December. | ||
|
||
## Contributors | ||
|
||
Thank you to all the contributors who made the release of 3.1.0 possible 🎉 | ||
|
||
According to `git shortlog -sn --no-merges 3.0.2..3.1.0` these are: | ||
|
||
``` | ||
61 Martin Odersky | ||
51 tanishiking | ||
50 Nicolas Stucki | ||
39 Kacper Korban | ||
33 Andrzej Ratajczak | ||
22 Dale Wijnand | ||
22 Olivier Blanvillain | ||
21 Lukas Rytz | ||
17 Filip Zybała | ||
16 Yichen Xu | ||
15 Rikito Taniguchi | ||
14 Sébastien Doeraene | ||
12 Krzysztof Romanowski | ||
11 EnzeXing | ||
9 Guillaume Martres | ||
9 Jamie Thompson | ||
8 Tom Grigg | ||
6 Seth Tisue | ||
5 Alec Theriault | ||
4 Michał Pałka | ||
4 Phil | ||
3 Fengyun Liu | ||
3 Paweł Marks | ||
2 Vadim Chelyshov | ||
2 Dmitrii Naumenko | ||
2 Julien Richard-Foy | ||
2 Kevin Lee | ||
2 Liu Fengyun | ||
2 Stéphane Micheloud | ||
2 Tomasz Godzik | ||
2 Adrien Piquerez | ||
2 adampauls | ||
2 noti0na1 | ||
1 Kai | ||
1 Jeremy Smith | ||
1 Som Snytt | ||
1 Anselm von Wangenheim | ||
1 Boris | ||
1 Arnout Engelen | ||
1 odersky | ||
1 Anatolii Kmetiuk | ||
1 PJ Fanning | ||
1 Matthieu Bovel | ||
1 Performant Data | ||
1 Mario Bucev | ||
1 Ruslan Shevchenko | ||
``` | ||
|
||
## Library authors: Join our community build | ||
|
||
Scala 3 has a set of widely-used community libraries that are built against every nightly Scala 3 snapshot. | ||
Join our [community build](https://github.com/lampepfl/dotty/tree/master/community-build) | ||
to make sure that our regression suite includes your library. | ||
|
||
[Scastie]: https://scastie.scala-lang.org/?target=dotty | ||
|
||
[@odersky]: https://github.com/odersky | ||
[@DarkDimius]: https://github.com/DarkDimius | ||
[@smarter]: https://github.com/smarter | ||
[@felixmulder]: https://github.com/felixmulder | ||
[@nicolasstucki]: https://github.com/nicolasstucki | ||
[@liufengyun]: https://github.com/liufengyun | ||
[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain | ||
[@biboudis]: https://github.com/biboudis | ||
[@allanrenucci]: https://github.com/allanrenucci | ||
[@Blaisorblade]: https://github.com/Blaisorblade | ||
[@Duhemm]: https://github.com/Duhemm | ||
[@AleksanderBG]: https://github.com/AleksanderBG | ||
[@milessabin]: https://github.com/milessabin | ||
[@anatoliykmetyuk]: https://github.com/anatoliykmetyuk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a promise? It isn't, right? We aren't sure if this will actually happen in 3.2.0? If so, consider weakening the wording a little, perhaps to "We are exploring possible technical solutions to..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is intended to be a promise - a promise that we will not release another minor version until we have a solution for the compatibility problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should commit - and therefore sound like we're committing - to that. That's not to say I'm not all for finding something better and shipping it in 3.2.0. But if it takes 6 months we might ship everything else as a minor release before the solution. So let's mention intent and desire, but no commitment.