This may have been discussed before, if so, please let me know.
Consider the following example:
x = 5
Dynamic[{Clock[], x}]
This will always display the current value of x
.
Now evaluate
Block[{x}, Pause[5]]
Notice that x
loses its global value!
Question:
Block
is commonly used to temporarily override definitions of user-defined symbols, package symbols, or built-ins. (There's also Interal`InheritedBlock
.)
What if, while the main (synchronous) evaluation is in the middle of a Block
, it is interrupted by a pre-emptive (asynchronous) evaluation? This pre-emptive evaluation could come from some Dynamic
construct in the front end or from a scheduled task.
The Block
in the main evaluation could potentially wreak havoc in the (supposedly independent) pre-emptive evaluation. This could cause very difficult to debug timing-dependent bugs that seem to occur completely randomly. This is very likely to happen if Block
is used to override a builtin.
Dynamic
thing. $\endgroup$