Can someone point me to a design document or discu...
# announcements
u
Can someone point me to a design document or discussion, why kotlin decided against statics?
a
uli: Because static methods are considered bad design even in java would be my guess. See: http://stackoverflow.com/a/7084473/4706743
u
Hi @Andreas Sinz , Thanks for your reply. I am well aware of the design problems with statics. What i don't see is where companion objects are better. For statics, you have the class object to hold them. For companion objects, an extra object which lives in parallel to the class object is created to hold something, we now don't call static any more. If i go through the list of issues with statics inside you stackocerfliw link, which one is remedied by companion objects? And how? On the other side they bring a relevant performance penality.
a
@uli simple, a
companion object
is an object. it can extend classes, implement interfaces or serve as a value at runtime