All the tutorials I read about type reification say that we need to use 'inline' when using 'reified', but none of them explain why.
Let's say I have a function:
inline fun <reified T> doSomething(value: T) {
println("Doing something with type: ${T::class.simpleName}")
}
As far as I understand, using 'reified' prevents type erasure. So why can't we make use of it in a normal non-inlined function. Using inlined is going to make the compiler copy the body of the above function at the call sites. But why do we need that to happen?