Travis Griggs
11/07/2023, 5:19 PMCLOVIS
11/07/2023, 5:21 PMFoo.kt
→ FooExt.kt
)
• if there are not really anything else in the package, I just name them after what they do (e.g. in this package, there is a sealed class and everything else is just extension functions on it)ephemient
11/07/2023, 5:29 PM${classname}s.kt
file, e.g. Floats.kt
for functions on `Float`sCasey Brooks
11/07/2023, 5:46 PMUtils
, because not every function in that file is strictly an “extension function”, and I guess I’m just used to the Java naming conventionTravis Griggs
11/07/2023, 8:36 PMStephan Schröder
11/07/2023, 9:37 PMKlitos Kyriacou
11/08/2023, 11:46 AMwhen defining extension functions for a class which are relevant for all clients of this class, put them in the same file with the class itself. When defining extension functions that make sense only for a specific client, put them next to the code of that client. Avoid creating files just to hold all extensions of some class.
This doesn't explain what you should do if you are defining extension functions that are relevant to all clients but they are extensions of a third-party class so you can't put them in with that class. In that case, ephemient's use of the plural of the class name sounds sensible.Daniel Pitts
11/15/2023, 4:01 PM_ClassName.kt
ephemient
11/15/2023, 11:31 PMClassName.kt
to hold extensions for classes defined in ClassName.java
ephemient
11/15/2023, 11:34 PMCollections.java
for extra Collection
functions, etc.