is using reified good or bad?
# announcements
c
is using reified good or bad?
t
reified function is useful, but it can't be called from Java.
h
If you need it, you should use it. If you need to support java clients, an overload that takes a class is generally sufficient to be "good". Your reified function can then call the overload as well and pass in T::class
c
i have T::class instead of Class<T>
as T reified
h
Yep. If you have to support java clients, go to your method that takes reified type, extract the whole Body, extract T::class there as a Parameter of type Class<T> and you have one version that takes class, one version without parameter using reification. If that's too complicated and you must not support java Clients, forget what i Said ;)
z
It can still be a good idea to extract large functions into non-reified functions with a reified wrapper even if you don't call it from java, since inline function bodies get copied into their call sites, so if you're making a lot of calls to large inline functions it can unnecessarily bloat your bytecode size.
h
Nice hint, that's true, didn't think about that :)