On Oct 21, 2013, at 8:09 PM, Seth Willits <[email protected]> wrote:

> What reason is there for the documents to have a strong reference to the 
> database?

The database object has all the core functionality including the underlying 
data storage engine. The document calls into the database to do the real work 
like loading or saving properties. So conceptually the connection to the 
database can’t be weak, because if it gets nil’ed out the document is busted 
and a lot of its methods will fail.

I guess you could answer that by saying that the API client should hold onto a 
strong reference to the database in order to keep using it, and if they let the 
database object drop on the floor (so to speak) they deserve whatever they get. 
That still seems kludgy to me, but I’ve been working with ref-counted systems 
for a long time* and I know very well that kludginess is sometimes needed to 
avoid cycles…

—Jens

* Jeebus, I think it’s been 29 years. I started using Smalltalk-80 as a summer 
intern in 1984; its garbage collector was ref-counted and couldn’t collect 
cycles.
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to