Re: Persistance
Re: Persistance
- Subject: Re: Persistance
- From: Marcel Weiher <email@hidden>
- Date: Wed, 10 Oct 2001 01:42:46 +0200
On Tuesday, October 9, 2001, at 06:05 PM, Erik M. Buck wrote:
I have a property list coder that I am contributing to the MiscKit. The
coder handles all of the issues with conditional encoding, graphs with
cycles, etc.
Nice. Did you manage to get the conditional encoding without having to
go through the encoding-cycle twice?
The one thing I don't have is a way to integrate property
coding with NSCoding since NSCoding does not accept a "name" argument
needed
to label the properties.
I would suggest using the NSCoding extensions and Macros provided with
MPWFoundation:
- an extension to NSCoding for named parameters is added
- a category implements this for the built-in NSCoders by ignoring the
names
- all new code should use the named coding extensions
- convenience Macros are provided
encodeVar( coder, variableName )
- as a last resort a hack is provided to get or make up names for
existing classes that don't provide a name
I noticed that you have NSObject additions for getting the name of an
instance variable at an offset. Can I use that code for contribution
to the
MiscKit ?
Sure, but please give credit.
However, I think that this particular hack should really only be used as
a very last resort (see above).
Incidentally, I've also recently added generic encode/decode methods
that use the ivar list to automatically encode/decode all instance
variables. For many 'dumb' classes, that can be quite sufficient (also
useful for -copy and possible even for -dealloc). All this
introspection-code should probably be moved to a generic
ClassDescription class used as a fall-back when other meta-information
is not available.
Regards,
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Mad Scientist HOM, IDEAs, MetaAd and more