Closed akovari closed 4 years ago
@kurobako I'm thinking about something like this:
I add some kind of ThreadLocal<Dict>
that will hold "context variables", which will be accessible anywhere inside of the with
<expr2>
. The key will be the <identifier>
part of the with
syntax, or if not provided, then the name has to be returned as the first element of a tuple from <expr>1
.
This ThreadLocal<Dict>
is set/removed in Threading.advance
.
There will be an internal and external API to access this ThreadLocal<Dict>
, probably in the Context
class, so that for example STMBuiltinModule
can access them, or anyone implementing functions using them, such as Dict
/Set
can access them (like the hasher function for instance).
Documented in https://yatta-lang.org/docs/resource-management/
Introduce a new type of
with
expression. This expression will allow accessing and manipulating local context variables within the expression in the body of thewith
expression.Standard library module will be necessary to allow reading/writing context variables.
Syntax
Usecases
dict
/set
hasher, seedFurther considerations
async
)