When evaluating this, the final value of a
is 0
as it should be, but Dynamic[a]
shows a 1
.
a = 0;
Dynamic[a]
Block[{a = 1}, Pause[1]; a];
(*1*)
When excluding all Pause
calls, there is no bug.
a = 0;
Dynamic[a]
Block[{a = 1}, a];
(*0*)
Is it possible to force Dynamic
to update without changing the value of a
?
Refresh
as inDynamic[Refresh[a, UpdateInterval->0]]
? $\endgroup$Pause
withDo[1, {10000000}];
-- I think it's a lengthy calculation that causes the system to updatea
when it is 1. $\endgroup$Clear[a]
solves it. Note that the second comes out0
only becausea
is restored to0
by the time the dynamic update executes. It's possible that it won't always be0
, I suppose, since there is a very small window between setting and restoringa
(in the second example). $\endgroup$