Re: half-initialized objects during decoding (Re: Persistance)
Re: half-initialized objects during decoding (Re: Persistance)
- Subject: Re: half-initialized objects during decoding (Re: Persistance)
- From: Richard Collins <email@hidden>
- Date: Thu, 11 Oct 2001 12:20:21 +0200
On Thursday, October 11, 2001, at 12:53 AM, cocoa-dev-
email@hidden wrote:
>
From: Chris Kane <email@hidden>
>
To: email@hidden
>
>
The 'half-initialized object' problems I was referring to I describe
>
below. Encoding is in several ways the easy direction. Decoding is
>
harder, and has a couple hard problems that I'm going to discuss here,
>
in the hopes that somebody has a clever idea.
>
>
In the general case, archiving has to deal with an object graph
>
with cycles in it.
....
>
A common example is in the AppKit: NSWindows reference the contained
>
views (via the top-level content view) and the views all reference the
>
window they're in. The window starts being decoded, and it calls
>
decodeObject to get the content view, which recursively decodes its
>
subviews etc.
Some one help me here. Encoding & decoding objects is in a context of
archiving, or saving and retrieving from disc.
Is it not contrary to the MVC architecture to be archiving a window? If
it were the responsibility of the controller to resolve circular
references as data is stored into the model, would not the problem go
away. My understanding is that it is a no-no to store state in a window.
Why do you want to save a window?
Of course, "archiving a window" is beside the point of resolving
circular references, but the questions above are still relevant to
avoiding the problem in the first place.
Richard Collins