Dave Mitchell wrote:
> On Wed, Apr 06, 2005 at 11:02:49PM -0400, Stas Bekman wrote:
> > It's time to write CLONE2 which should be a method, identical to DESTROY,
> > which should be called by perl_clone(), when it sees that the
> > object->can('CLONE2').
>
> After some chatting with Stas, we've come to the conclusion that what he
> needs most is the ability, on a per-class basis, to disable the cloning of
> objects; ie in the child thread, each SvOBJECT() SV becomes an SVt_NULL
> SV. This avoids all the problems of multiple calls to DESTROY, multiple
> pointers to C structures etc.
>
> The question then is how to flag a particular class (and its subclasses)
> as being 'don't clone'.
>
> The current suggestion is to have a class method called SHOULD_CLONE(),
> and just before creating the new thread, this method is called, once per
> stash, in the context of the parent thread. Any stash which has this
> method and where it returns a false value, will be marked as 'don't clone'
> for the duration of the cloning.
>
> Better suggestions for the technique or the method name are welcome :-)
Why define a method to return a negative value ? DONT_CLONE() that returns
true seems more logical.