Sorry for the obscure title, here is a snippet that would explain much better:
var a = [Vector2()]
a[0].x = 42
var b = a[0]
b.x = 43
print(a) # Returns [Vector2(42, 0)]
# Same behavior with Dictionary and Pool*Array :'-(
I've encountered this behavior while working on Godot-Python (see https://github.com/touilleMan/godot-python/issues/93 for a more in-depth explanation of the reason of this behavior).
I'm not sure this behavior has to be corrected (I would guess the cost would be high given it deals with internal implementation of containers and I didn't see other issue about this...). However we could add a line about this exotic thing in the GDscript documentation when talking about containers.
Vector2 is a value type, so what you are doing is expected. b is not a reference to the item in the array, and doesn't need to be.
Indeed, as far as I know this is expected behaviour.
Just read the last line, yeah this could be made clearer in the docs.
Moving to godot-docs.
Most helpful comment
Vector2 is a value type, so what you are doing is expected.
bis not a reference to the item in the array, and doesn't need to be.