import kotlin.reflect.*
class Foo {
val foo = "hello"
}
var bar = 42
fun main() {
val baz = "world"
println(Foo()::foo.variableNameAndValue)
println(::bar.variableNameAndValue)
//println(::baz.variableNameAndValue) sadly doesn't work for local variables :(
}
val KProperty0<*>.variableNameAndValue get() = "$name: ${get()}"