Sure, but one might argue that `Person("Dave", age...
# announcements
k
Sure, but one might argue that
Person("Dave", age = 30)
is also resolvable at compile-time. Is there anything else that requires
const
?
r
One would be wrong
k
Of course, I was just arguing that Jake's explenation wasn't really intuitive for a beginner.
b
Person("Dave", age = 30)
could also invoke a
init
block, adding logic that can't be known at compile time, such as serialization, network requests, and GUI operations
👍 1
k
Let's say for he purpopses of my argument there's
data class Person(val name: String, val age: Int)
right below it.
b
Yes, but this is still perfectly valid:
Copy code
data class Person(val name: String, val age: Int) {
    init {
        println("Oops")
    }
}
Perhaps a
const data class
that doesn't allow any initializer logic, and whose parameters must be
const
as well?
this is starting to sound a lot like that
inline data class
idea
1