One significant difference is the following
In version 10.3.1
a = 3;
Association[Unevaluated[a -> 2]][Unevaluated[a]]
2
In version 11.0.1
a = 3;
Association[Unevaluated[a -> 2]][Unevaluated[a]]
Association[Unevaluated[a->2]][Unevaluated[a]]
In version 11.0.1 (clearing attributes)
Unprotect[Association];
ClearAttributes[Association, HoldAllComplete];
a = 3;
Association[Unevaluated[a -> 2]][Unevaluated[a]]
SetAttributes[Association, HoldAllComplete];
Missing[KeyAbsent,3]
(*should be interpreted as Missing[KeyAbsent, a], as 3 is actually a valid key here*)
I see this change as a reminder that that Association
is not meant to be used like this (with keys that are "unstable"/unevaluated). In this answer, taliesin says: "But generally this just sounds like a dangerous and confusing game to play, to me". There have been good arguments against using Association
like this, like the fact that if you Compress
and Uncompress
an Association
, it would evaluate its keys.
Interestingly it is still possible to create a broken association in 11.0.1, which may be a bug of PositionIndex
.
a = "Fail!";
p = PositionIndex[Unevaluated[{a, b, c, d}]]
Uncompress@Compress@p
<|a->{1},b->{2},c->{3},d->{4}|>
<|Fail!->{1},b->{2},c->{3},d->{4}|>
An aspect of the difference is that in versions newer than 10.4, evaluation takes place "behind the scenes". This explains the shorter traces in mikado's answer.
In version 10.3.1
Trace[Association[1 + 1 -> 2]]
{{{1+1,2},2->2,2->2},Association[2->2],<|2->2|>}
In version 11.0.1
Trace[Association[1 + 1 -> 2]]
Trace[Association[1 + 1 -> 2], TraceInternal -> True]
{Association[1+1->2],<|2->2|>}
{Association[1+1->2],{{{1+1,2},2->2,2->2},{2->2}},<|2->2|>}
Attributes[Association]
, this is also documented byInformation[Association]
(??Association
) orDefinition[Association]
. The documentation page forAssociation
states that it wasUpdated in 2016 (10.4)
$\endgroup$