Skip to content

Where to put extension methods #833

Open
@MasseGuillaume

Description

@MasseGuillaume

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)
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions