<div dir="ltr"><div dir="ltr"><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">OK, so it's possible for application code called from a framework to<br>
override the caller's context, as long as that context was a parent<br>
of the current context. That seems like a significant weakening of<br>
the guarantees that scoped values provide.<br><br></blockquote><div><br></div><div>Yes, and a few days ago I would have also said that it might weaken the guarantees. However, you might have missed it in the infinite sea of emails, but I have actually figured out a way how this can be implemented [1]. The only problem is that the implementation is very inefficient compared to the fact that it effectively just does what you wrote: "override the caller's context, as long as that context was a parent of the current context" (does it with an otherwise completely pointless parallelization). See `CapturedScopes.withCurrentContext` (I called this method `withCapturedContext` in a previous email, sorry for the inconsistency).</div><div><br></div><div>That is, providing this feature in the JDK would not weaken any guarantees.</div><div><br></div><div>[1]: <a href="https://gist.github.com/kelemen/5a334e3d189f91355c4615ad94d0b6fd">https://gist.github.com/kelemen/5a334e3d189f91355c4615ad94d0b6fd</a></div><div> </div></div></div>