In exploring Working with DynamicModule: Tracking the progress of Initialization, I came across this. The following usually shows a value for x
of 300000
to 400000
after initialization. It varies each time.
DynamicModule[{x}, Dynamic[x], Initialization :> (x = 1;
Do[x = i, {i, 10000000}];
x = 2;
Do[x = i, {i, 10000000}];
x = 3;)]
If the option SynchronousInitialization -> True
is set, a similar thing happens, although the displayed value for x
ranged from 18000
to 9900000
. On the other hand, if SynchronousInitialization -> False
is set, the displayed value is 3
, as expected.
Is this a bug, or is it to be expected, due to some aspect of the dynamic updating system I'm not aware of?
Version: 10.0.0, 9.0.1, and 8.0.4; Max OSX 10.9.4.