I need to create two versions of a function, a sus...
# getting-started
j
I need to create two versions of a function, a suspendable one and a non-suspendable one, I want to make it explicit in the name which one is or isn't suspendable. What you would be a good antonym of "suspendable"? I could write
mySuspendableFunction
but what would be the name of the other function?
myNonSuspendableFunction
seems a bit too verbose. Or maybe should I go with
myAsyncFunction
and
mySyncFunction
? But those `async`/`sync` words are never used in Kotlin's terminology.
y
Blocking
is the convention for a non-suspending variation of a function. Usually, we also just name the suspending function without highlighting that it is suspending, because the type system takes care of that
j
what would you do in case of invocable classes? The type system doesn't help here:
Copy code
class BlockingClass {
    operator fun invoke(): Unit = TODO()
}

class SuspendableClass {
    suspend operator fun invoke(): Unit = TODO()
}
y
I would call it
Class
and
BlockingClass
,
j
thank you !