Can anyone explain what is `reified` I'm unable to...
# announcements
k
Can anyone explain what is
reified
I'm unable to understand the concept behind this one
k
k
ok so is it just syntax sugar and does the same reflection behind the scenes so we dont have to see the ugly code? @karelpeeters
k
It doesn't do reflection at all, since it is always
inline
it can inline the type parameter in things like
foo is T
as well. But yes, the purpose is to hide avoid ugly reflection code.
k
got it thanks
@karelpeeters can o tell why this example provided in the docs throwing exception
Copy code
inline fun <reified T> membersOf() = T::class.members

fun main(s: Array<String>) {
    println(membersOf<StringBuilder>().joinToString("\n"))
}
k
I can't test right now (not at a computer), does it work directly, ie. without reified funtion calls?
k
It works in the IDE but throws error in try.kotlinlang.org
k
Then there's probably something wrong with the site.
k
I guess and also they must provide an option to try the beta releases online Like an option btw stable and beta