theapache64
11/24/2022, 10:25 AMtheapache64
11/24/2022, 10:26 AMJoffrey
11/24/2022, 10:47 AMlouiscad
11/24/2022, 1:29 PMlouiscad
11/24/2022, 1:29 PMJoffrey
11/24/2022, 1:29 PMlouiscad
11/24/2022, 1:30 PMJoffrey
11/24/2022, 1:30 PMcompanion object : KLogging()
And then we can use logger
in the class.louiscad
11/24/2022, 1:31 PMsuspend
on a next line as a companion object name when it has no body nor any subclass though.
class A {
companion object
suspend fun thisDoesntSuspend()
}
Joffrey
11/24/2022, 1:32 PMlouiscad
11/24/2022, 1:32 PMlouiscad
11/24/2022, 1:33 PMJoffrey
11/24/2022, 1:33 PMReason being that they compete with constructors for my most common usagesWhile I understand the rationale, I would find it weird to have it above non-constructor properties. Usually I want my properties just below the main constructor properties.
Joffrey
11/24/2022, 1:34 PMIt shows: "there's more outside this file"Well you can't really show that for the class itself, so I'm not sure it's worth considering this advantage for the companion
louiscad
11/24/2022, 1:34 PMlouiscad
11/24/2022, 1:35 PMJoffrey
11/24/2022, 1:38 PMlouiscad
11/24/2022, 1:40 PMJoffrey
11/24/2022, 1:41 PMlouiscad
11/24/2022, 1:41 PMlouiscad
11/24/2022, 1:42 PMJoffrey
11/24/2022, 1:44 PMI personally have no rule besides "it works" and "most important first"Actually same here. I don't have a hard rule that makes me put it at the end every time. But for some reason I find that this has been what works best for me almost every time (apart from the logging stuff mentioned above). I guess habit has to do with it ๐ but that's becoming circular reasoning. I have a habit of being consistent, and I like the consistency of my habit ๐
Xad Kile
11/24/2022, 4:16 PM