Updated Proposal: Revisiting Implicits

One thing I was wondering about, will the new encoding of type-parametrized implicit conversions pose a performance issue? In Scala 2, the encoding is like this:

implicit def foo[B](list: List[B]): Option[B] = list.headOption

and so the overhead is just a method call which is almost free. Now the encoding is something like this (forgive syntax errors)

given [B]: Conversion[List[B], Option[B]] = _.headOption

Will this create a new allocation of a Conversion object at each conversion site? That might add up to a lot of extra allocations.

3 Likes