Sometimes I stumble upon the situation when I need...
# announcements
r
Sometimes I stumble upon the situation when I need two properties for something to work -- private with ability to modify it and public which works as a read-only facade. For example:
Copy code
private val connectedChannel = ConflatedBroadcastChannel<Boolean>()    // has send() modification method
val connected: ReceiveChannel<Boolean>    // has a read-only interface
        get() = connectedChannel.openSubscription()
There are several pairs of such properties in a class. Coroutines are just one of many examples, there are much more use cases. Does anybody know the way to avoid this repetitiveness?