Consider the case class:
case class IntPrinter(implicit val i: Int) {
def print()(implicit i: Int) = println(i)
}
I can, for example, explicitly pass the value for the implicit argument as follows:
val p = IntPrinter()(9)
I was told by the IRC that from now on, the explicitly transmitted value will be implicitly passed for printing when called, but this is not so:
p.print()
error: could not find implicit value for parameter i: Int
Am I doing something wrong or am I misunderstanding / receiving incorrect information? Is there any way to achieve this?
EDIT:, in fact, it works as expected if I import p._as follows:
import p._
p.print()
What really prints 9.
Is this the right behavior? Uses importas a bad idea, how does it sound? How do i solve this?
source
share