Or is this even relevant?
What I have in mind is using the ClassTag
or TypeTag
annotations, like so:
scala>
import scala.reflect.runtime.universe.TypeTag
def f[T : TypeTag](ls : List[T]) : String = {
???
}
results in :
f: [T](ls: List[T])(implicit evidence$1: reflect.runtime.universe.TypeTag[T])String
As you can see, the TypeTag
is seen by the compiler which adds an implicit argument. Is there an equivalent in scala.meta
? How will this work, and will there be any changes in the way erasure is handled?
At the moment scala.meta
does not provide runtime introspection, however, that's planned for future releases. APIs would be similar to scala.reflect
(but in terms of scala.meta
, e.g. different Abstract Syntax Trees
, no exposed compiler internals, etc), and I really hope that end user wont see much difference.
So, functionality of ClassTag/TypeTag
is not likely to disappear. Most probably, scala.meta
will use a bridge (paradise
) to get access to scalac
internals (and that involves scala.reflect
).
Also note that scala.reflect
will be supported in scala 2.x
branch, but not in dotty
.