-
Notifications
You must be signed in to change notification settings - Fork 371
Closed
Description
Please, see explicit-backing-fields.md for the full text in PR #289.
Summary
Sometimes, Kotlin programmers need to declare two properties which are conceptually the same, but one is part of a public API and another is an implementation detail. This is known as backing properties:
class C {
private val _elementList = mutableListOf<Element>()
val elementList: List<Element>
get() = _elementList
}
With the proposed syntax in mind, the above code snippet could be rewritten as follows:
class C {
val elementList: List<Element>
field = mutableListOf()
}
bloderxd, HE-SOFT, IliasRedissi, mykola-dev, andylamax and 43 moremcpiroman, andylamax, elect86, Sparky983, yeuchi and 1 moreLordRaydenMK, edrd-f, STAR-ZERO, luizrcs, Ayfri and 35 more
Metadata
Metadata
Assignees
Labels
No labels