hi guys, a debate has opened up in my team about w...
# announcements
m
hi guys, a debate has opened up in my team about where to put constants. So, imagine you have some class with a “private” constant, say
internal const val BASE_URL = "<http://xyz.com>"
. Companion objects or package level? On the one hand, it seems to me the Kotlin way to do things is at the package level. Companion objects are meant to be used when the internals of a class are needed in a static context. Or maybe for Java interoperability in some cases. On the other hand, the const can be seen as a property of a class, not a package, so it belongs in the class itself, not the package. Which is more correct in Kotlin?