Given the following object with 2 implicits:
scala> object Foo {
| implicit def stringToInt(x: String) = 555
| implicit def stringToBoolean(x: String) = true
| }
warning: there were two feature warnings; re-run with -feature for details
defined object Foo
I can use them:
scala> def f(x: Int) = x
f: (x: Int)Int
scala> import Foo._
import Foo._
scala> f("asdf")
res0: Int = 555
scala> def g(b: Boolean) = b
g: (b: Boolean)Boolean
scala> g("asdfasdf")
res1: Boolean = true
Then, I tried to disable the stringToInt
implicit.
scala> import Foo.{stringToInt => _}
import Foo.{stringToInt=>_}
But, evidently, that did not work.
scala> f("adsfasdf")
res2: Int = 555
After wildcard importing implicits, is it possible to hide them?
Basically, I'd like to use all of Foo
's implicits, minus a single one, stringToInt
.
Note - of course I could simply do import Foo.stringToBoolean
only, but, for my scenario, Foo
has ~25 imports, and I want to use 24 of them. As a result, it's more concise to use all, and then subtract one.
JavaConverters._
. No sane person would attempt to enumerate them. – Maze