Copying a coll into another coll, efficiently?
Hi there,
Here is a way to - sometimes - copy a coll into another one:
Is there a more efficient way?
The refer message is great to globally talk to a coll. I would find it very useful to have a copy coll-name message, a message that would not refer but make an actual copy of a whole coll. Does it already exist? I couldn't find it!
The 'refer' message makes both colls refer to the same memory space, as you've noted, which is not what you want. I agree that your feature request would provide a new and different capability. In the meantime, here's another kludge. Save the original to disk, read it into the other coll, then save that coll to disk. You end up with two different files on disk (which you can choose to use or ignore the next time the patch is loaded; I ignore them in this example), and the 'refer' message is never invoked, so the two colls remain independent.
Cool idea, I had not thought of it.
Indeed, my feature suggestion would be along the lines of what exists for [dict]: sending a named dict into the left input of another one make a copy.
Bumping this feature request: a "clone" message for the [coll] object would be very useful.
Sometimes, you need a [dict], sometimes, you need a [coll].
You can use coll's dump message to clone a coll: