-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update and fix the generic extension methods document and the RC1 release blog #11451
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
Update and fix the generic extension methods document and the RC1 release blog #11451
Conversation
Strictly speaking the "only if" is correct. The other two forms of call parameterize the argument to the extension method, not the method itself. But maybe that's hair-splitting. I like the proposed alternative. |
Can we merge this one? |
I do not think this is hairsplitting, I think this is pretty important. We are parameterising precisely the argument and not extension method. It is the same thing as to say, “there are two ways to provide type parameters to a method, def f[T](x: T, y: T): T = y
val x = "foo"
val y = 10
f[String](x, y) // error
f(x: String, y) // no error, inferred type is Any We should not mislead people in our docs. |
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.
(see above comment)
|
||
- When the method is referenced as an extension method: | ||
|
||
```scala | ||
List("a", "bb", "ccc").sumBy[Int](_.length) | ||
``` |
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.
Looks good, this change should be applied to the blog also.
- Adjust the markdown to follow markdown style conventions - Synchronize the document "Extension Methods" with the blog article "Scala 3.0.0-RC1 - first release candidate is here"
416f4f5
to
2603848
Compare
Thanks! @anatoliykmetyuk I think I misunderstood the document, and I wasn't clear about the concepts. I just update this PR and revert the change about generic extension methods in 2021-02-17-scala3-rc1.md. |
# Settling on `scaladoc` as the documentation tool | ||
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) | ||
## Settling on `scaladoc` as the documentation tool | ||
|
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.
What's the motivation behind using heading level 2 instead of 1 and leaving a newline?
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.
@anatoliykmetyuk I invite you to look at the Google Style Guide, for instance the section Add spacing to headings.
IMO the best choice would be to adher to an existing style guide or (at least) to agree on a minimal set of rules which work both with Scaladoc and with tools such as Pandoc (see PR #11257).
If you have questions or any sort of feedback, feel free to send us a message on our | ||
[Gitter channel](https://gitter.im/lampepfl/dotty). If you encounter a bug, please | ||
[open an issue on GitHub](https://github.com/lampepfl/dotty/issues/new). | ||
|
||
### Contributors |
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.
Why 3rd header level here? In all blog articles, this item is a top-level header.
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.
@anatoliykmetyuk Fixed.
I update the extension-methods.md and the corresponding part in the 2021-02-17-scala3-rc1.md.The only if in this paragraphis not right. Now it supports 4 different forms of callI update the extension-methods.md, and make it consistent with the corresponding part in the 2021-02-17-scala3-rc1.md.
Change the level of headings in 2021-02-17-scala3-rc1.md.
the markdownlint of my editor tells me we shouldn't use multiple top level headings in one file.
I'm not sure if this follows our convention for the release blog article. If we want to keep using multiple top level headings, please tell me, and I can revert this change.