Bug introduced in 10.1 or earlier and fixed in 10.3
According to the documentation, in order to make sure that a value in an association is not evaluated at initialization, one can use a RuleDelayed. This works fine:
Clear[x]
assoc = <| "a" -> x, "b" :> (x = 1;) |>;
{ assoc["a"], assoc["b"]; assoc["a"] }
Now, I want to have a key that clears the association if I extract its value. Like this:
assoc = <| "clear" :> Clear[assoc] |>;
However, any Mathematica expression that is executed after assigning assoc clears assoc (in Mathematica 10.1). What is going on?
Edit
It turns out this is a bug caused by the Suggestions Bar as pointed out by the user ilian. Turning off the Suggestions Bar in Edit->Preferences->Interface fixed the issue.
assocclearsassoc. – Praan Jul 17 '15 at 18:00