So do I understand correctly that lambdas no longe...
# language-evolution
t
So do I understand correctly that lambdas no longer have implicit access to context parameters at all? The KEEP and some other places still reference this as an option fairly recently. When was that removed? I must be missing some discussion
y
It's not removed no. Lambdas can't have named context parameters though, so you have to use
contextOf<Foo>()
if you want the value itself
t
Yeah but that's a lot more verbose than if they are available implicitly as receivers, such as in the KEEP in §1.8
Copy code
withConsoleLogger {
  // you can call functions with Logger as context parameter
  logWithTime("doing something")
}
the above appears to no longer work
c
You can if there is a bridge function
Copy code
context(logger: Logger)
fun logWithTime(message: String) = logger.logWithTime(message)
t
Ohh I see, thank you! That seems a bit verbose if you want to make all properties of a context object available in the lambda, but I guess it works
c
I agree
d
Yikes, I liked context receivers specifically because they reduced boilerplate, but now I've got to add extra boilerplate to do it?
y
Write-once biolerplate though. The point is to have a specialised API surface for context access
d
I can do that without context parameters though.
t
As far as I can tell currently you still get autocompletions for context-dependent functions if you do not have the relevant context, I hope that at least changes at some point