JEP draft: Scope Locals
Alan Snyder
javalists at cbfiddle.com
Wed May 12 19:12:20 UTC 2021
From the motivation section:
> So you want to invoke a method X in a library that later calls back into your code. In your callback you need some context, perhaps a transaction ID or some File instances. However, X provides no way to pass a reference through their code into your callback. What are you to do?
When I read this, my first thought was… pass a callback that is bound to the context.
I suppose the example you have in mind has a fixed callback. Is this a common practice? Doesn’t it point to a deficiency in the library API?
Is this feature just a workaround for poorly designed libraries, or are there other examples?
Alan
More information about the loom-dev
mailing list