_methods

object _Methods
Source
__.scala
class java.lang.Object
trait scala.Matchable
class Any

Member

opaque type Self[+A]

Self View Methods

Self view is another library available for all types, but it has to be activated by calling a universal ".self" method on original value.

For example:

 val pack: Pack[String] = "FOO".self.pack

Due to opaque implementation, calling self view methods incures no overhead as if they were called directly on base value.

A common use case is to manipulate an object within expression context:

 val a : Array[String] = new Array[String](1).self(_(0)="A")

because all calls are inlined, the above expression is equivalent to:

 val a : Array[String] = new Array[String](1)
 a(0)="A"
Source
Self.scala