Well I don’t have it yet, I’m trying to think ahead before starting to code. But schematically:
module ModWithState
global_state = Dict()
struct TrackedVar{T}
value::T
end
end
Now what I want to do and don’t know how, is to keep track of a kind of graph structure between these tracked vars. For example, if I were to type in the repl (schematically):
x = TrackedVar(5)
y = TrackedVar(2)
z = x + y
Then z
should be a TrackedVar
with value 7 and furthermore, global_state
should be somehow encode the graph structure implied by z=x+y
, for example something like Dict(x=>[], y=>[], z=>[x,y])
.