Hi! I'm experimenting with creating a generic Obse...
# announcements
s
Hi! I'm experimenting with creating a generic Observable/Observer in Kotlin. In my design, Observable is an interface which can be delegated to by concrete implementations. I'm running into a problem where I cannot enforce the creation of hasChanged() in the Observable implementations because interfaces require all methods be declared public. My goal is to make it such that the Observable implementations have interface methods which can only be called by the classes that delegate to them and not classes consuming the delegator. It doesn't seem like this is possible with the current type system. I was thinking it could be accomplished by marking the methods in the interface as 'protected', since that actually seems to provide meaningful semantics in the case of delegation, if not a little strange. Does anyone have any idea how I might accomplish this?