Nameof to get names of program elements

Out of curiosity, what’s wrong with some first-class functions to handle this?

fun nameOf(callable: KCallable<*>): String = callable.name
fun nameOf(clazz: KClass<*>): String = clazz.simpleName!!
fun nameOf(clazz: Class<*>): String = clazz.simpleName

Use like so…

data class MyAwesomeClass(val myAwesomeProperty: Int) {
    fun helloWorld() = Unit
}

fun main(vararg args: String) {
    println(nameOf(MyAwesomeClass::class))
    println(nameOf(MyAwesomeClass::myAwesomeProperty))
    println(nameOf(MyAwesomeClass::helloWorld))
}

Works for classes, properties, functions…the only case I’ve found where it won’t work is local fields.