Skip to content

Commit c414e8c

Browse files
Merge pull request #11451 from ShapelessCat/fix-and-imrpove-extension-methods-docs
Update and fix the generic extension methods document and the RC1 release blog
2 parents 95fa9cb + 61a05c9 commit c414e8c

File tree

2 files changed

+33
-17
lines changed

2 files changed

+33
-17
lines changed

docs/blog/_posts/2021-02-17-scala3-rc1.md

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ date: 2021-02-17
88

99
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.
1010

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.
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,
12+
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.
1213

1314
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!
1415

1516
<!--more-->
16-
# Allow secondary type parameter list in extension methods
17+
## Allow secondary type parameter list in extension methods
18+
1719
Type parameters on extensions can now be combined with type parameters on the methods themselves. E.g.:
1820

1921
```scala
@@ -27,6 +29,7 @@ Type arguments matching method type parameters are passed as usual:
2729
```scala
2830
List("a", "bb", "ccc").sumBy[Int](_.length)
2931
```
32+
3033
By contrast, type arguments matching type parameters following `extension` can be passed
3134
only if the method is referenced as a non-extension method:
3235

@@ -42,7 +45,8 @@ sumBy[String](List("a", "bb", "ccc"))[Int](_.length)
4245

4346
For discussion, see [PR #10940](https://github.com/lampepfl/dotty/pull/10940). For more information about the extension methods, see [documentation](https://dotty.epfl.ch/docs/reference/contextual/extension-methods.html).
4447

45-
# New `import` syntax
48+
## New `import` syntax
49+
4650
The following are the changes to the `import` syntax made in this release.
4751

4852
Wildcard import `_` is replaced by `*`. The motivation is that the majority of other languages use `*`. For example:
@@ -60,10 +64,12 @@ import NumPy as np
6064

6165
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).
6266

63-
# Use `*` for vararg splices.
67+
## Use `*` for vararg splices
68+
6469
[PR #11240](https://github.com/lampepfl/dotty/pull/11240) changed the syntax of vararg splices in patterns and function arguments. The new syntax uses a postfix `*`, instead of `: _*`, analogously to how a vararg parameter is declared.
6570

66-
# Use `uninitialized` for wildcard initializers
71+
## Use `uninitialized` for wildcard initializers
72+
6773
An obscure use of `_` occurs in var definitions:
6874

6975
```scala
@@ -84,7 +90,8 @@ This way expresses the intent of the idiom in a more verbose and easy to read wa
8490

8591
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.
8692

87-
# Eta-expand companion object if functions are expected
93+
## Eta-expand companion object if functions are expected
94+
8895
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:
8996

9097
```scala
@@ -104,18 +111,26 @@ Results in:
104111

105112
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.
106113

107-
# Settling on `scaladoc` as the documentation tool
108-
We have settled on using the well-known `scaladoc` as a name for the documentation tool for Scala 3 (known previously as `scala3doc`).. The obsolete `dotty-doc` (or `scala3-doc`) is removed in RC1. We have also removed all the Kotlin dependencies (Dokka, etc.) from scaladoc. For details, see [PR #11349](https://github.com/lampepfl/dotty/pull/11349). To read more about `scaladoc`, see [documentation](https://dotty.epfl.ch/docs/usage/scaladoc/index.html)
114+
## Settling on `scaladoc` as the documentation tool
115+
116+
We have settled on using the well-known `scaladoc` as a name for the documentation tool for Scala 3 (known previously as `scala3doc`).
117+
The obsolete `dotty-doc` (or `scala3-doc`) is removed in RC1. We have also removed all the Kotlin dependencies (Dokka, etc.) from scaladoc.
118+
For details, see [PR #11349](https://github.com/lampepfl/dotty/pull/11349). To read more about `scaladoc`, see [documentation](https://dotty.epfl.ch/docs/usage/scaladoc/index.html)
119+
120+
## Use `future` and `future-migration` to specify language versions after 3.0 in `-source`
109121

110-
# Use `future` and `future-migration` to specify language versions after 3.0 in `-source`
111122
[PR #11355](https://github.com/lampepfl/dotty/pull/11355) changes the `-source` specifier for the Scala version(s) after 3.0 from `3.1` to `future`. I.e. it is now
112-
`-source future` and `-source future-migration` instead of `-source 3.1` and `-source 3.1-migration`. Language imports are changed analogously. The reason for the change is that we want to keep the possibility open to ship a `3.1` version that does not yet contain all the changes enabled under `-source future`.
123+
`-source future` and `-source future-migration` instead of `-source 3.1` and `-source 3.1-migration`. Language imports are changed analogously. The reason for the change is that
124+
we want to keep the possibility open to ship a `3.1` version that does not yet contain all the changes enabled under `-source future`.
125+
126+
## Other language changes
113127

114-
# Other language changes
115128
- Warn when matching against an opaque type [#10664](https://github.com/lampepfl/dotty/pull/10664)
116-
- 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. This setting allows you to specify a version of the Java platform (8, 9 etc) and compile the code with classes specific to the that Java platform, and emit the bytecode for that version.
129+
- 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.
130+
This setting allows you to specify a version of the Java platform (8, 9 etc) and compile the code with classes specific to the that Java platform, and emit the bytecode for that version.
131+
132+
## Metaprogramming changes
117133

118-
# Metaprogramming changes
119134
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:
120135

121136
- Add `scala.quoted.Expr.unapply` as dual of `Expr.apply` [#10580](https://github.com/lampepfl/dotty/pull/10580)
@@ -132,13 +147,14 @@ A lot of work has been done on the metaprogramming side of things. Mostly we are
132147
- Rename `Not` to `NotGiven` to make its purpose clearer [#10720](https://github.com/lampepfl/dotty/pull/10720)
133148
- Fix [#10709](https://github.com/lampepfl/dotty/issues/10709): Add missing level check before inlining [#10781](https://github.com/lampepfl/dotty/pull/10781)
134149

135-
# Let us know what you think!
150+
## Let us know what you think!
151+
136152
If you have questions or any sort of feedback, feel free to send us a message on our
137153
[Gitter channel](https://gitter.im/lampepfl/dotty). If you encounter a bug, please
138154
[open an issue on GitHub](https://github.com/lampepfl/dotty/issues/new).
139155

140-
141156
## Contributors
157+
142158
Thank you to all the contributors who made this release possible 🎉
143159

144160
According to `git shortlog -sn --no-merges 3.0.0-M3..3.0.0-RC1` these are:

docs/docs/reference/contextual/extension-methods.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ List("a", "bb", "ccc").sumBy[Int](_.length)
8989
```
9090

9191
By contrast, type arguments matching type parameters following `extension` can be passed
92-
only if the method is referenced as a regular method:
92+
only if the method is referenced as a non-extension method:
9393

9494
```scala
9595
sumBy[String](List("a", "bb", "ccc"))(_.length)
9696
```
9797

98-
or, passing, both type arguments
98+
Or, when passing both type arguments:
9999

100100
```scala
101101
sumBy[String](List("a", "bb", "ccc"))[Int](_.length)

0 commit comments

Comments
 (0)