Scoped variables

Ben Berman benjamin.s.berman at gmail.com
Tue Jul 16 17:38:14 UTC 2019


I would second Jon's note on logging. Here are some more:

 - Game virtual machines. This would be my application. Example: Games AI.
 - Tracing. Example: SpanContexts in Jaeger.
 - Common request, user identity and authorization contexts.  Example:
Vertx contexts and user identity
 - APIs for network or process distributed locks and timers. Example:
Atomix's locks and timers
 - Database transaction contexts.  Example: Cassandra's WriteContext
 - Probabilistic programming language virtual machines. Example: Figaro.

On Thu, Jul 11, 2019 at 10:39 AM Jon Harper <jon.harper87 at gmail.com> wrote:

> Hi list,
> I read with much interest the "scoped variable" discussion from
> December 2018:
> https://mail.openjdk.java.net/pipermail/loom-dev/2018-December/thread.html
>
> Towards the end of the conversation, the following was stated:
>
> > dean.long at oracle.com ; 12/7/18 1:15 PM
> > Now might be a good time to start a discussion on how we want scoped
> variables to be created and named.
> > Doug Lea dl at cs.oswego.edu ;  Sun Dec 9 14:32:07 UTC 2018
> > Or backing up further, how about a discussion of use cases that should
> be covered?
>
> Has this been done and is there a link to a conclusion ?
>
> My favorite use case is implementing what various logging frameworks
> call Diagnostic Contexts in a way that is safe for everyone, whether
> they use threads manually or abstracted behind Executors (or using
> loom's fibers). I think the current agreement is that Diagnostic
> Contexts are too dangerous (currently implemented with threadlocals)
> because they can spill from one context to another when using
> Executors, resulting in false logs. Logs are a prime example where you
> don't want to explicitly pass a context object everywhere but still
> want your logs to display contextual informations (like a request id).
> This is especially true when you want to add a new log somewhere in
> the code where the context is not passed and you have to backtrack all
> the call chain and add the context object to all the intermediate
> method arguments.
>
> Cheers,
> Jon
>


More information about the loom-dev mailing list