Re: Guidelines for Cocoa frameworks supporting garbage collection?
Re: Guidelines for Cocoa frameworks supporting garbage collection?
- Subject: Re: Guidelines for Cocoa frameworks supporting garbage collection?
- From: Ben Trumbull <email@hidden>
- Date: Sun, 6 Jul 2008 16:21:16 -0700
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 (email@hidden)
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:
This email sent to email@hidden