I store a reference to the association in a held expression in a variable:
a=<||>;
b=Hold[a];
And in the code, I want to do manipulations with the original variable a including using methods that have HoldFirst attribute.
AssociateTo[b,"test"->1];
(* this obviously does not work *)
AssociateTo[ReleaseHold@b,"test"->1];
(* this does not either *)
Question is, how do I use b in AssociateTo[] to associate the value to the original globally-defined a association?
To clarify, my use case is that I store data in a nested Association stored as CloudExpression and create references ("indexes") of the values inside this association as Hold[] constructs. This works perfectly fine until I get to use the HoldFirst-set methods.
Update:
I was able to implement the desired behaviour using the ugly
AssociateToHold[assoc_,data_]:=
ReleaseHold@
Replace[
Hold[AssociateTo[where,what]]/.
{HoldPattern[where]->Unevaluated[assoc],HoldPattern[what]->data},
Hold[x_]:>x,{2}
]