Skip to content

Commit 4ff5021

Browse files
Add RC1 blog article
1 parent 2bb42d5 commit 4ff5021

File tree

1 file changed

+149
-0
lines changed

1 file changed

+149
-0
lines changed
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
---
2+
layout: blog-page
3+
title: Scala 3.0.0-RC1 – first release candidate is here
4+
author: Anatolii Kmetiuk
5+
authorImg: /images/anatolii.png
6+
date: 2020-02-18
7+
---
8+
9+
Greetings from the Scala 3 team! We are delighted to announce the first release candidate of the stable version of Scala 3 – Scala 3.0.0-RC1.
10+
11+
This release brings some last-minute polishings, clean-ups and changes before the big release. There were a few language changes to improve the user experience, as well as the polishings of the metaprogramming framework. We have also worked on the issues that had to be fixed before the stable release.
12+
13+
Overall, more than [400 PRs](https://github.com/lampepfl/dotty/pulls?q=is%3Apr+is%3Aclosed+closed%3A%3E2020-12-02+sort%3Acomments-desc) were merged after the M3 release and until today! Read more below!
14+
15+
<!--more-->
16+
17+
# New `import` syntax
18+
The following are the changes to the `import` syntax made in this release.
19+
20+
Wildcard import `_` is replaced by `*`. The motivation is that the majority of other languages use `*`. For example:
21+
22+
```scala
23+
import scala.annotation.* // imports everything in the annotation package
24+
```
25+
26+
Renaming operator `=>` is replaced by a soft keyword `as`. `as` is also allowed outside braces. For example:
27+
28+
```scala
29+
import scala.collection.mutable as mut
30+
import NumPy as np
31+
```
32+
33+
For the details and discussion, see [PR #11244](https://github.com/lampepfl/dotty/pull/11244). Read more about this change in the [documentation](https://dotty.epfl.ch/docs/reference/changed-features/imports.html).
34+
35+
# Use `unitialized` for wildcard initializers
36+
An obscure use of _ occurs in var definitions:
37+
38+
```scala
39+
var x: T = _
40+
```
41+
42+
It defines a concrete variable x without an initial value, or rather the default initial value that the JVM assigns to object fields. It can only be used in a class or object, not to initialize a local variable.
43+
44+
We came up with an arguably better way to express this idiom: the special `uninitialized` value in the `scala.compiletime` object. To get an uninitialized field, you now write:
45+
46+
```scala
47+
import scala.compiletime.uninitialized
48+
49+
var x: A = uninitialized
50+
```
51+
52+
This way expresses the intent of the idiom in a more verbose and easy to read way than simply writing an underscore.
53+
54+
For discussion, see [PR #11231](https://github.com/lampepfl/dotty/pull/11231), and the [documentation](https://dotty.epfl.ch/docs/reference/dropped-features/wildcard-init.html) is available on our website.
55+
56+
# Allow `with` after class
57+
[PR #11157](https://github.com/lampepfl/dotty/pull/11157) brings an syntactic change whereby you have to write `with` instead of `:` to signify the start of the body of a class definition. For example:
58+
59+
```scala
60+
object Foo with // Was previously `object Foo:`
61+
val x = 10
62+
```
63+
64+
# Eta-expand companion object if functions are expected
65+
Starting from RC1, we no longer generate a function parent for companions of case classes. Which means, for example, that given `case class Foo(x: Int)`, you won't be able to use `Foo` in a position where a function is expected:
66+
67+
```scala
68+
case class Foo(x: Int)
69+
def f(g: Int => Foo) = g(10)
70+
71+
f(Foo)
72+
```
73+
74+
Results in:
75+
76+
```scala
77+
1 |f(Foo)
78+
| ^^^
79+
|The method `apply` is inserted. The auto insertion will be deprecated, please write `rs$line$1$#Foo.apply` explicitly.
80+
```
81+
82+
As the warning suggests, now you should write `Foo.apply` instead of `Foo`. See [Issue #6190](https://github.com/lampepfl/dotty/issues/6190) and [PR #7207](https://github.com/lampepfl/dotty/pull/7207) for discussion.
83+
84+
# Other language changes
85+
- Warn when matching against an opaque type [#10664](https://github.com/lampepfl/dotty/pull/10664) - a useful warning added to draw your attention when you are trying to match against an opaque type.
86+
- Fix [#8634](https://github.com/lampepfl/dotty/issues/8634): Support -release option [#10746](https://github.com/lampepfl/dotty/pull/10746) – the same way Scala 2 does.
87+
88+
# Metaprogramming changes
89+
A lot of work has been done on the metaprogramming side of things. Mostly we are cleaning up and polishing the API to prepare it for the stable release. The following are the important metaprogramming changes that took place:
90+
91+
- Add `scala.quoted.Expr.unapply` as dual of `Expr.apply` [#10580](https://github.com/lampepfl/dotty/pull/10580)
92+
- Remove `Expr.StringContext.unapply` [#10675](https://github.com/lampepfl/dotty/pull/10675)
93+
- Add reflect `MatchCase` `TypeRepr` [#10735](https://github.com/lampepfl/dotty/pull/10735)
94+
- Rename scala.quoted.staging.{Toolbox => Compiler} [#11129](https://github.com/lampepfl/dotty/pull/11129)
95+
- Fix [#10863](https://github.com/lampepfl/dotty/issues/10863): Make show `AnyKind`ed [#10988](https://github.com/lampepfl/dotty/pull/10988)
96+
- Add ParamClause to allow multiple type param clauses [#11074](https://github.com/lampepfl/dotty/pull/11074)
97+
- Rework reflect Symbol fields API [#10705](https://github.com/lampepfl/dotty/pull/10705)
98+
- Rename `Liftable` to `ToExpr` and `Unliftable` to `FromExpr` [#10618](https://github.com/lampepfl/dotty/pull/10618)
99+
- Expand non-transparent macros after Typer [#9984](https://github.com/lampepfl/dotty/pull/9984)
100+
- Rework TastyInspector API to allow inspection of all files [#10792](https://github.com/lampepfl/dotty/pull/10792)
101+
- Allow leading context parameters in extension methods [#10940](https://github.com/lampepfl/dotty/pull/10940)
102+
- Rename Not to NotGiven to make its purpose clearer [#10720](https://github.com/lampepfl/dotty/pull/10720)
103+
- Fix [#10709](https://github.com/lampepfl/dotty/issues/10709): Add missing level check before inlining [#10781](https://github.com/lampepfl/dotty/pull/10781)
104+
105+
# Let us know what you think!
106+
If you have questions or any sort of feedback, feel free to send us a message on our
107+
[Gitter channel](https://gitter.im/lampepfl/dotty). If you encounter a bug, please
108+
[open an issue on GitHub](https://github.com/lampepfl/dotty/issues/new).
109+
110+
111+
## Contributors
112+
Thank you to all the contributors who made this release possible 🎉
113+
114+
According to `git shortlog -sn --no-merges 3.0.0-M3..3.0.0-RC1` these are:
115+
116+
```
117+
TODO
118+
```
119+
120+
If you want to get your hands dirty and contribute to Dotty, now is a good time to get involved!
121+
Head to our [Getting Started page for new contributors](https://dotty.epfl.ch/docs/contributing/getting-started.html),
122+
and have a look at some of the [good first issues](https://github.com/lampepfl/dotty/issues?q=is%3Aissue+is%3Aopen+label%3Aexp%3Anovice).
123+
They make perfect entry points into hacking on the compiler.
124+
125+
We are looking forward to having you join the team of contributors.
126+
127+
## Library authors: Join our community build
128+
129+
Dotty now has a set of widely-used community libraries that are built against every nightly Dotty
130+
snapshot. Currently, this includes shapeless, ScalaPB, algebra, scalatest, scopt and squants.
131+
Join our [community build](https://github.com/lampepfl/dotty/tree/master/community-build)
132+
to make sure that our regression suite includes your library.
133+
134+
[Scastie]: https://scastie.scala-lang.org/?target=dotty
135+
136+
[@odersky]: https://github.com/odersky
137+
[@DarkDimius]: https://github.com/DarkDimius
138+
[@smarter]: https://github.com/smarter
139+
[@felixmulder]: https://github.com/felixmulder
140+
[@nicolasstucki]: https://github.com/nicolasstucki
141+
[@liufengyun]: https://github.com/liufengyun
142+
[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain
143+
[@biboudis]: https://github.com/biboudis
144+
[@allanrenucci]: https://github.com/allanrenucci
145+
[@Blaisorblade]: https://github.com/Blaisorblade
146+
[@Duhemm]: https://github.com/Duhemm
147+
[@AleksanderBG]: https://github.com/AleksanderBG
148+
[@milessabin]: https://github.com/milessabin
149+
[@anatoliykmetyuk]: https://github.com/anatoliykmetyuk

0 commit comments

Comments
 (0)