[RFC] clone semantics

Peter Lobsinger plobsing at gmail.com
Thu Mar 11 21:13:10 UTC 2010


On Thu, Mar 11, 2010 at 3:00 PM, Allison Randal <allison at parrot.org> wrote:
> On 3/11/10 7:11 PM, Peter Lobsinger wrote:
>> These PMCs are expected to provide a certain vtable-based API (I
>> should document that somewhere)
>
> Yes, please write up briefly for PDD 17, and pass the patch around the list
> for review.

Will do.

>> but are free to provide that as they
>> see fit. For example, freezing and cloning traversals can keep their
>> state in a "seen" hash; marking traversal (which probably shouldn't
>> allocate while traversing, but is hopefully unique per-interpreter at
>> a given time) might keep its state in PObj flags.
>
> To be clear, the "seen" hash is stored as an attribute of the VisitClone
> PMC? And each deep-cloning process is a unique instance of the VisitClone
> PMC, in much the same way that each iterator is a unique instance of
> HashIterator/ArrayIterator?

Yes, each traversal has a one-to-one mapping with a visitor instance
which contains (using attributes) whatever state required to manage
the traversal. This may or may not include a "seen" hash, because the
API does not explicitly require one.


More information about the parrot-dev mailing list