When you copy a thing, are references in that thing to other things copied as references or are copies made of the things referenced?
When copying a list of things, are just the references in the list copied, or do you get back a list of new things copied from the thinsg in the original list?
Allright, based on experiments, th answer is both
When you copy a list of objects, the objects in the list get duplicated, but their fields get shallow copied.
SO I’m now beating my head against how to deep copy a list of lists…
Edit: I could do it with a recursive back-end workflow. I wish there was a simpler way though…
A deep copy of a variable copes the value of the variable so you have 2 separate variables.
A shallow copy just copies a refence to a variable (often, but nto always, a memory address) so you have a single variable referred to in multiple ways.
In databases, the idea extends by analogy. A deep copy is a new record. A shallow copy is another field referring to the same primary key.
You can try using backend workflows to recursively create Things and then copy the contents. For example, let’s say a User has a list of Posts. Instead of copying User, create a new User, create a list of new Posts, and copy the contents of the posts.
Avoiding infinite loops on a directed potentially cyclic graph is a relatively easy computer science problem, btw. You just use a node index for already visited nodes. Basic hashtable works great for this.