The output from the following code does not behave how I think it should. It appears that making changes to the string array returned by testAA.require() does not reflect in the associative array. I thought dynamic arrays were pass by reference, but this seems to be behaving contrary to this notion. Re-assigning the array to testAA does appear to work, but the reason why this does not work is bothering me. Any tips or ideas would be appreciated!
module main;
import std.stdio;
void main()
{
string[][string] testAA;
string[] vals = ["InitVal1", "InitVal2"];
auto list = testAA.require("Key", vals);
writeln("list: ", list);
list ~= "Val1";
list ~= "Val2";
writeln("list: ", list);
writeln("testAA", testAA);
}
This results in the output:
list: ["InitVal1", "InitVal2"]
list: ["InitVal1", "InitVal2", "Val1", "Val2"]
testAA["Key":["InitVal1", "InitVal2"]]