My experience has been that almost every time I've convinced myself
that it was safe to use a particular collectable object in another's
finalize, I was just plain wrong.

This has been my experience as well.

Because the ordering of finalization is undefined, it will often work anyway, making for difficult to reproduce bugs. I've wasted so much time debugging this that I've just abandoned this idiom as impractical.

The people I've talked to supporting this as a tenable idiom make unmaintainable assumptions about encapsulation violations, and inheritance implementation details, e.g. that the receiver, or its superclass, won't change in the future in ways that invalidate their assumptions. The dependencies are incredibly fragile and messaging other objects in finalize is just not worth my time.

I never message another object in finalize unless my object being finalized owns a CFRetain on the receiver.

'"nuke the entire site from orbit. It's the only way to be sure"

- Ben

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to