https://kotlinlang.org logo
j

jshmrsn

02/01/2016, 11:03 AM
Continuing a conversation in #C0922A726 with @kirillrakhman. It might be a nice syntax feature to be able to add the companion modifier directly to a function and have that function inserted into the companion class's definition (and create the companion class if it isn't already specified). For simple use cases of companions functions, especially when you don't have members for your companion, this would provide a syntax more similar to Java's static, for better or worse. In my use case, I have a terribly oversized class, and it's becoming hard to know at a glance if a particular method is in the companion or in the class itself. It would be nice to have that companion modifier right next to the method like you'd have in Java. Granted, I should not have such an oversized class