-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add RC1 blog article #11417
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
Add RC1 blog article #11417
Conversation
7be6eb9
to
470c1e0
Compare
I think we should mention that we settle on using |
@@ -92,13 +92,13 @@ By contrast, type arguments matching type parameters following `extension` can b | |||
only if the method is referenced as a regular method: |
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 @odersky
It seems the "only if" is not right. Even though the code
List[String]("a", "bb", "ccc").sumBy(_.length)
List[String]("a", "bb", "ccc").sumBy[Int](_.length)
doesn't fit this context (they are not regular / non-extension method calls), they can work when I try them in Scala 3.0.0-RC1 REPL. If this is expected. I think it's better to edit this paragraph and keep all these 4 forms in this reference doc.
By the way, personally, the type arguments usage in the non-extension method call form looks weird.
Also, I think replace the "regular method" with "non-extension method" make this sentence clearer.
When I read this document before, since the code example doesn't fit the context, I didn't get the meaning of "regular". Also, since the extension method syntax is legal, it's also a kind of "regular" method.
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.
Good point. We should add all 4 forms.Can someone make a PR for that?
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’m not sure the List[String]
form can be regarded as a way to pass type parameters to an extension method. We are not passing any parameters to the extension methods, we are helping the compiler to infer the type parameters of the callee precisely. It’s still on the compiler to then infer the type parameters for the extension method; I do not see how explicitly specifying the type parameter of the callee helps the latter task.
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.
var x: T = _ | ||
``` | ||
|
||
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. |
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.
Can we just say null
?
99efb73
to
f4b0536
Compare
[skip ci]