Skip to content

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

Closed
wants to merge 1 commit into from
Closed

Add code tabs for _tour/implicit-conversions #2565

wants to merge 1 commit into from

Conversation

flomebul
Copy link
Contributor

As this update is more complex due to evolution between 2 and 3, thanks to re-read carefully.

implicit def int2Integer(x: Int) =
java.lang.Integer.valueOf(x)
implicit def int2Integer(x: Int): java.lang.Integer =
x.asInstanceOf[java.lang.Integer]
Copy link
Member

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 %}
Copy link
Member

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

Copy link
Member

@bishabosha bishabosha left a 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]`.
Copy link
Member

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

Suggested change
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]`.
@bishabosha
Copy link
Member

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.

@bishabosha bishabosha closed this Oct 4, 2022
@julienrf
Copy link
Contributor

julienrf commented Oct 4, 2022

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.

@flomebul flomebul deleted the implicit-conversions branch December 19, 2022 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants