On Tuesday, 29 November 2022 at 23:25:46 UTC, DLearner wrote:
On Tuesday, 29 November 2022 at 19:06:20 UTC, rikki cattermole wrote:
[...]

Please see the following example:
...

I think this was discussed before a few weeks ago here (But I don't remember the thread), and this is a design choice, for example this:

    VarArr2 = VarArr1;

VarArr2 is just pointing to the same address of VarArr1 as you can see by:

   writeln(VarArr1.ptr);
   writeln(VarArr2.ptr);

To do what you want, you need to use "dup":

   VarArr2 = VarArr1.dup;

Now it will work as you expect.

I think this is confusing but in the end it's a design choice, instead of copy just point, and if you need to copy, you need to it explicitly.

Matheus.

Reply via email to