Bug introduced in 10.4.1 or earlier and persisting through 11.1.0 or later
Using x++
or x=x+1
inside Defer
generates strange results.
Evaluating the following commands one by one (in three different input cells), with Shift+Enter, one gets:
x=1;
Defer[x++];
x
(* 15 but I have also seen 17! *)
Even stranger, if one creates a notebook with only those same commands, restarts the kernel, and does Evaluation ► Evaluate Notebook
then the command x
returns 1
instead of 15
.
Any explanations?
Comments
Post a Comment