Just a heads-up for folks about a bug I just encountered in the new version 10.0.2 since this broke some legacy code of mine and can cause problems with a standard programming trick in Mathematica.
In Version 10.0.1 the following works correctly:
MapAt[f, Function[z, CreateWindow[]], 2]
gives
Function[z, f[CreateWindow[]]]
Thus respecting the HoldAll Attribute of Function.
However in the just-released 10.0.2 this is broken. In 10.0.2 the second argument of the Function is executed. Thus this
(Sorry to pick on you, but) Why is this not a very good bug report?
The answer is that it allows for too many possibilities. For one, it invokes functionality only found in the User Interface. Is it a UI-specific bug? Kernel?
Try this variant:
MapAt[f, Function[z, Sin[2.]],2]
(Upshot: it’s a kernel issue.)
Don’t fret though, you might get the last laugh here (read: it could be mine).
Actually I found the problem in something else… And, yes, I put the CreateWindow in the example as I was ferreting things out from a much bigger piece of code so that I could see the problem happening explicitly from the window appearing and “bugging” me.
But your point is well taken.
And here is a simplification (I think ) that removes the pure function and focuses on the violation of the HoldAll:
Okay. Actually I now feel free to pick away (read: turns out it wasn’t mine). I filed a detailed report and expect it will not be too hard to track down.