Imagine we have the following structure (like a module)
(*separate file*)
<|
"package"->"blabla",
"internal parameter"->0
"delayed action":>With[{},%["internal parameters"]=1;]
|>;
(*somewhere in the code*)
module = Get["file_with_association_above"];
module["delayed action"];
module["internal parameter"] == 1
It would be very convenient to implement something like this, where when we call ["delayed action"] function from the association, it will modify the variable that stores this function.
However, now I got an error as expected
Set::write: Tag RuleDelayed in "delayed action":>%["internal parameters"] is Protected.
I have found that there is a function Names[], that can be used to look through all defined symbols and in the theory one can find the right variable and modify it. But, I think it would be really slow.
PS: Yes, I am looking for the analogue of @this keyword, like an object self-reference, but in the terms of Mathematica's paradigm.