On 2008 Oct, 27, at 12:32, Andy Lee wrote:

I don't see that instance variable. I only see a private _managedObjectContext instance variable in the header, which you wouldn't have access to anyway. Am I missing something?

Well, there NSPersistentDocument has -managedObjectContext and - setManagedContext: methods. So, I presume that there is an instance variable in there somewhere.

Should he also override -setManagedObjectContext:?

That's a whole'nother weird subject. Trying to get rid of super's moc, I tried this:

NSPersistentDocument* doc = [[NSPersistentDocument alloc] init] ;
NSLog(@"After initing, moc = %@", [[doc managedObjectContext] description]) ;
[doc setManagedObjectContext:nil] ;
NSLog(@"After nilling, moc = %@", [[doc managedObjectContext] description]) ;

Here's what I got:

  After initing, moc = <NSManagedObjectContext: 0x117190>
  After nilling, moc = <NSManagedObjectContext: 0x117190>

:{

My 2 cents: this seems like a brittle design -- it expects the overrider to know that the superclass never uses the ivar directly except in accessors, and it expects the implementer of the base class to remember never to use the ivar directly...

Yes, the more I think about this, the less I like it. I'm going to step back here and try to avoid overriding that moc.

In any case, I think the documentation could be clearer and I'll send feedback to that effect.

Great!

_______________________________________________

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