<https://kotlinlang.org/docs/object-declarations.h...
# getting-started
a
https://kotlinlang.org/docs/object-declarations.html 1. is
x
not data property? 2. what is data property? I can not find difinition in Properties
h
I find the name "data property" confusing too, it’s not used anywhere else, but it stands for the properties defined in the (primary) constructor of a data class:
Copy code
data class Foo(val b: Int) {
val s: String = ""
}
b
is a "data property", while s is a normal property.
a
so crazy and confused. can we invite JetBrain team to answer this question?
c
There's nothing more to say, what Philip said is correct. A data property is just a property that's in the primary constructor of a data class.
j
https://kotlinlang.org/docs/data-classes.html#properties-declared-in-the-class-body describes the significance of properties declared in constructor
k
It seems to be true that the term "data properties" is not defined properly before use on that page. However, it is defined formally in the Kotlin Language Specification:
A data class is a special kind of class, which represents a product type constructed from a number of data properties, [...], described in its primary constructor.
It may be worth asking someone from JetBrains if they would make the tutorial page on data classes clearer with respect to this definition.
g
There is a literally "Edit page" button on top of the page to send PR