Skip to content

Where to put extension methods #833

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

Open
MasseGuillaume opened this issue Jul 25, 2017 · 2 comments
Open

Where to put extension methods #833

MasseGuillaume opened this issue Jul 25, 2017 · 2 comments

Comments

@MasseGuillaume
Copy link

http://docs.scala-lang.org/overviews/core/value-classes.html#extension-methods

This section should show the two available options:

package object foo {
  implicit class RichInt(val self: Int) extends AnyVal {
    def toHexString: String = java.lang.Integer.toHexString(self)
  }
}

or

object Foo {
  implicit class RichInt(val self: Int) extends AnyVal {
    def toHexString: String = java.lang.Integer.toHexString(self)
  }
}
@SethTisue
Copy link
Member

pull request?

jan0sch added a commit to wegtam/docs.scala-lang that referenced this issue Aug 1, 2018
Add a short explanation and two examples.
@jan0sch
Copy link
Contributor

jan0sch commented Aug 1, 2018

PR created: #1117

jan0sch added a commit to wegtam/docs.scala-lang that referenced this issue Aug 1, 2018
Add a short explanation and two examples.
jan0sch added a commit to wegtam/docs.scala-lang that referenced this issue Aug 1, 2018
Add a short explanation and two examples.
jan0sch added a commit to wegtam/docs.scala-lang that referenced this issue Aug 1, 2018
Add a short explanation and two examples.
jan0sch added a commit to wegtam/docs.scala-lang that referenced this issue Aug 1, 2018
Add a short explanation and two examples.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants