a = 1;
Button["Print", a++]
Button["Print", Dynamic[a++]]
Button["Print", Dynamic[a++];]
Button["Print", {Dynamic[a++]}]
Dynamic @ a
The second Button
is not supposed to change the value of a
but it does.
Have I missed something or is it a bug?
Why it is not supposed to?
Button[label,action]
[...] evaluates action whenever it is clicked.
Evaluation is supposed to leave Dynamic
intakt and if it is part of returned result MakeBoxes
will create DynamicBox
which is supposed to be handled by FrontEnd
which should send contents to evaluation when needed.
Yet the Button
isn't creating any visible result when clicked.
While Button["Print", Dynamic[a++]]
isn't useful in general, the leak is the leak.
A support case with the identification [CASE:3609709] was created
[...] I have filed an incident report with the information you provided.
[...] I have also filed a second incident report for the documentation example [...]