[FR] Facilitate monitoring of variables
Ideally i would like to specify monitored variables in the constructor like
p = ProgressUnknown( "description", monitor = ( x, y, z ) )
And then everytime I call ProgressMeter.next! or ProgressMeter.update!, they are populated with the showvalues = (( :x, x ), (:y, y ), (:z, z )) automatically.
How would you propose the implementation would look like? What would be stored in the progress struct when it is constructed for this to be possible?
I would think it should be possible to save e.g. x as Symbol and the tricky part would be to get the value of x when one of the updating methods gets called.
Maybe via observables ?
tricky part would be to get the value of x when one of the updating methods gets called.
Indeed. You would need to capture a reference to the already existing variable and then u
So for example:
x = Ref(0)
p = ProgressUnknown( "description", monitor = (:x => x)
for i in 1:100
x[] = 1
showprogress(p)
end
There doesn't seem to be a large, if any at all, advantage over this vs just using the showvalues functionality.
The advantage is less code duplication if you have something like conditional progress updates like scan_m here.
Not a very important feature. More likely a "nice to have".