-
Notifications
You must be signed in to change notification settings - Fork 1k
Add code tabs for _tour/implicit-conversions #2565
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
Conversation
implicit def int2Integer(x: Int) = | ||
java.lang.Integer.valueOf(x) | ||
implicit def int2Integer(x: Int): java.lang.Integer = | ||
x.asInstanceOf[java.lang.Integer] |
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.
not sure why this change to cast was made
{% endtabs %} | ||
|
||
{% tabs implicit-conversions_3 %} | ||
{% tab 'Scala 2 and 3' for=implicit-conversions_3 %} |
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 think it looks better if this code example is duplicated in both of the above tabs, rather than making a separate tab group
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 think the majority of this article is pretty confusing and outdated, so trying to update it for scala 3 is adding more confusion
{% endtab %} | ||
{% tab 'Scala 3' for=implicit-conversions_1 %} | ||
|
||
An implicit conversion from type `S` to type `T` is defined by an `implicit def` of type `S => T`, or by a `given` instance of type `conversion[S, T]`. |
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 think its better to go all-in on the Scala 3 way to do things
An implicit conversion from type `S` to type `T` is defined by an `implicit def` of type `S => T`, or by a `given` instance of type `conversion[S, T]`. | |
An implicit conversion from type `S` to type `T` is defined by a `given` instance of type `scala.Conversion[S, T]`. |
I'm sorry to close this, but I think this chapter of the tour needs a restructuring to make sense - so I will not accept this PR, feel free to reopen if you want to take an attempt. |
Thank you @flomebul for your great help so far! To add to Jamie’s comment, we want to leverage the “Scala 2/3 code tabs” effort to also clean up some pages of the documentation that need to be refreshed, and this page is one of them. We will either come up with more specific instructions for external contributors like you to help, or we will open the PR ourselves. |
As this update is more complex due to evolution between 2 and 3, thanks to re-read carefully.