https://kotlinlang.org logo
Title
e

Erik

09/02/2021, 3:31 PM
And more general than my question above: is there a comprehensive list of naming conventions used in Kotlin Some examples: the stdlib is full of functions that have an
OrNull
variant. Or in the coroutines lib, it's conventional to either write a
suspend fun foo()
or write a non-suspending extension
fun CoroutineScope.foo()
, but not
suspend fun CoroutineScope.foo()
. And likewise,
suspend fun foo(): Flow<Bar>
usually doesn't make sense, but
fun foo(): Flow<Bar>
is more conventional. It's probably a good idea to use the same naming conventions in your own Kotlin APIs.
c

CLOVIS

09/03/2021, 6:54 AM
Bonus convention: the difference between
.sort
and
.sorted
.
👍 1
e

Erik

09/03/2021, 7:20 AM
Shuffle, shuffled
Reverse, reversed
j

Jacob

09/03/2021, 6:05 PM
https://elizarov.medium.com/coroutine-context-and-scope-c8b255d59055 not doing
suspend fun CoroutineScope.foo()
. is about more than a naming convention.