Hi, I've been working on TT #1015 (clone_p_p segfaults with self-referential Hash pmc).
The problem of what the clone vtable/opcode actually means has come up. We have a test in t/pmc/iterator.pmc that asserts that clone is shallow (the clone iterates over the same array). Meanwhile, docs/book/pir/ch04_variables.pod says that clone is deep (no changes to the original affect the clone). Both have desirable properties and are sometimes appropriate, but we must be consistent in what we mean when we call clone. Deep clone can be built out of shallow clone and visit. AFAICT, shallow clone cannot be built out of deep clone easily or efficiently. Beyond shallow vs. deep cloning, given shallow clone + visit, one could implement a clone with an arbitrary policy (eg: don't clone classes, don't clone subs, don't clone iterator's arrays, only clone 42 levels deep, etc). Therefore, I propose that clone be made explicitly shallow, and a deep cloning op and/or PMC can be provided. TT #1015 can then easily be closed by making hash clone non-recursive. _______________________________________________ http://lists.parrot.org/mailman/listinfo/parrot-dev
