At 14:31 -0800 12/4/03, Stas Bekman wrote:
Actually, these are both configurable seperately. You can specify whether all objects have DESTROY called on them (including the cloned ones), or only the original ones. Default is only original ones.
And you can specify a fixup routine for cloned objects. Of which the default is none.
Sounds good. I wonder whether it's safe to assume that if fixup is provided than DESTROY should be called as well for the CLONED objects.

Well, if a cloned object is fixed up (or post_cloned_reconstructed), it seems logical to me it should be DESTROYed as well.



Hmmm... didn't realize you can create blessed objects from XS.
Moreover, I think that's what 99.9% of XS modules do. bless is really a non-XS module thing, and non-XS modules don't need the reconstruction anyway.

No true. I had to jump through these hoops for just about all Thread::xxx modules I made, e.g. Thread::Pool. You don't want the pool destroyed when one of the worker threads exits... ;-)



But yes, the actual bookkeeping routine could be made available externally, something like:
Thread::Bless->register( $object );
would that help?
Yes it would.

To enhance its flexibility, you can register any number of objects in a single call.




... In fact I'd suggest to drop the CORE::bless overriding thing altogether as you may interfere with similar overrides.

It honours whatever overrides for CORE::bless existed already. And it makes the general case (which I think just the not DESTROYing of cloned objects) very easy to add: just add:


use Thread::Bless;

to your module's code.


Just tell users to call this register method from new(), just after they have blessed the object.

That goes against the principle of least interference. To me, this is really a problem that should be fixed at the system level, e.g. with a pragma.



Liz



Reply via email to