14

Implicit functions with several parameters are allowed, that is:

implicit def it(path: String, category: String):Iterator[String] = ...

But can the Scala compiler do something useful with it? If not, why doesn't it complain?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
yura
  • 14,489
  • 21
  • 77
  • 126

1 Answers1

18

Yes, the compiler can do something with it if you ask for such an implicit.

def f(implicit ev: (String, String) => Iterator[String]) = ...
Daniel C. Sobral
  • 295,120
  • 86
  • 501
  • 681
  • Wonderful scala, if not as implicit converter, then as implicit argument ) – yura Aug 29 '11 at 23:17
  • 1
    @yura If you look into Scala Language Specification, you'll see that these two things are actually unified. Looking up implicit conversion from `A` to `B` is equivalent to looking up implicit parameter of type `A => B`. So implicit conversions and implicit parameters are roughly the same thing under the hood. – ghik Jun 01 '13 at 23:26