https://kotlinlang.org logo
Title
p

Polina

02/08/2019, 8:43 AM
Hello! I had a question about file naming convention for file which contains multiple classes or only top-level declarations. https://kotlinlang.org/docs/reference/coding-conventions.html#source-file-names - use name with a upper first letter, but https://github.com/JetBrains/kotlin - use name with a lower first letter. What would be better? I prefer second way, but in little confuse why official kotlin github no follow official kotlin convention
h

hho

02/08/2019, 8:47 AM
Where did you find that
use name with a lower first letter
?
Kotlin itself uses source files starting with uppercase letters, see for example https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib/src/kotlin/collections
h

hho

02/08/2019, 8:55 AM
That's part of the build, not (directly) part of Kotlin itself. Anyway, I'd highly recommend following the convention from the docs.
a

aoriani

02/08/2019, 5:35 PM
It seems that if it is a single class file, then it matches its name of the class (which start with capital letters), But if the file contains multiple declarations it uses initial lowercase.
That's what I can reckon from the presented sample.
m

Mike

02/08/2019, 9:08 PM
The link above to collections is a folder. Look at all the files within it and they're all uppercase first.