No, there is nothing that differentiates a regular function from an extension function. So following the "rules" of what is a pure function remains the same between the two.
I.e.
fun add(x: Int, y: Int): Int = x + y
fun Int.add(y: Int): Int = this + y
These functions are identical, we can even see that if we assign them using method referencing.
val f: KFunction2<Int, Int, Int> = ::add
val g: KFunction2<Int, Int, Int> = Int::add
Exact same
KFunction
type, so using an extension function doesn't affect purity. If you access a database, then it should take
database
as a parameter or live inside an interface where the impl has access to
database
.