How to update Associative Array?
tastyminerals
tastyminerals at gmail.com
Thu Feb 10 10:59:17 UTC 2022
Not sure if the `update` method got changed but I am having
trouble with understanding it now.
I assumed it would work as easy as in Python:) Just do
`mydic.update(dic)` or `mydic["key"].update(anotherDic)`.
The docs have the following example.
```
class C{}
C[string] aa;
C older;
C newer;
aa.update("a",
{
newer = new C;
return newer;
},
(ref C c)
{
older = c;
newer = new C;
return newer;
});
```
This looks pretty scary and confusing to me tbo. Also, why is
there an example with class and not simple `int[string]`? I just
need to know how can I update let's say `int[string]` or nested
`int[string][string]` AA. Should I also initialise and additional
C classes before calling this method as in the example?
Considering this is the only example in the docs I could find on
how to update AA, imagine someone from Python world comes and
sees this. Next thing he does, is close the page and never come
back to D again :(
More information about the Digitalmars-d-learn
mailing list