Just re-phrasing what Dmitry said about them being different entities, since it took a bit for it to click with me when first reading the context receiver proposal. But basically the're different
kinds of receivers
context(MyContext)
fun useMyContext() {}
This function can't be used like an extension receiver:
val myContext: MyContext
// Won't compile, since `myContext` is being used as an extension receiver, but a context was expected
myContext.useMyContext()
I'm pretty sure you can't even do this:
with (myContext) {
this.useMyContext()
}
The main distinction is that a function
can be called within multiple scopes/contexts, but, you can't really
.call()
a function on multiple variables at once. So having
Logging
and
Application
both as "extension" receivers doesn't make sense. (though it could in the future with tuples)