Hi,
I’m instantiating several Dictionaries using one as a blueprint and I noticed that Arrays contained in the Dictionary seem to be somehow liked.
Here’s an example of what I’m observing
(
var p, q;
p = Dictionary.with(*[
\values -> [],
\name -> "yo"
]);
q = Dictionary.newFrom(p);
"CHECK VALUES\n---".postln;
p[\values] = p[\values].add([1,2,3]);
q[\values].postln;
p[\values][0] = [4,5,6];
q[\values].postln;
"\nCHECK NAME\n---".postln;
q[\name].postln;
p[\name] = "hello";
q[\name].postln;
)
and this is what I’m getting on the console
CHECK VALUES
---
[ [ 1, 2, 3 ] ]
[ [ 4, 5, 6 ] ]
CHECK NAME
---
yo
yo
So, the first element contained in p[\value] (which is another Array) is exactly what I’m getting when calling q[\value][0].
This doesn’t seem to happen with other Objects (eg Strings).
I’m sure I’m missing something obvious here but, atm nothing springs to mind tbh, so I thought I’d ask here.