Is there a way to see the parts of context receive...
# eap
m
Is there a way to see the parts of context receivers that are currently available? The closest thing to docs i know of is the KEEP which is more of a proposal than up to date docs. the main difference im seeing is not having the
context(...){ }
scoping function to provide multiple values to the implicit context for calling functions with context params. Is this planned for a future release or has the implementation and plans just diverged from the original KEEP?
1
y
Those functions should eventually be added to stdlib, but in the meantime you can define them yourself:
Copy code
inline fun <A, B, R> context(a: A, b: B, block: context(A, B) () -> R {
  contract {
    callsInPlace(block, EXACTLY_ONCE)
  }
  return block(a, b)
}
1
thank you color 1
And
implicit
is provided in that KEEP as such:
Copy code
context(ctx: A) fun <A> implicit(): A = ctx
☝🏾 1