Is it to late for Kotlin to add an equivalent of C++ const keyword ?
class MyClass {
const fun bar() { ...} // 'const' mean bar doesn't change state of this
fun baz() { ... } //
}
class Demo {
private val _theThing = MyClass()
get theThing: const MyClass
}
fun main() {
Demo().theThing.bar() // legal
Demo().theThing.baz() // not legal => getter implie const object, baz function not declared const
}