可观察的属性

var foo : Int by Delegates.observable("1") { property, oldValue, newValue ->
    println("${property.name} was changed from $oldValue to $newValue")
}
foo = 2

该示例打印 foo was changed from 1 to 2