Re: [gtk-list] Re: Serialization (was: Re: GTK questions)



Andrew Thomas wrote:

> I think that GTK would need a substantial (and
> much deserved IMHO) re-thinking of the data/code division before you
> would be able to serialize objects and object hierarchies with any
> completeness.  I know that this would generate an "incompatible" GTK+,
> but I for one would be willing to bite the bullet to get a better
> architecture out of it.

After spending a couple of days poring through gle and GTK+ and a few other
bits of code, I've decided that an object persistance library would be better
implemented at the GLIB level than at the GTK+ level.  Why?

- GTK's object model as it stands is *really* optimized for doing GUI work and
is clumsy at best for data structures.
- GLIB already has good data structure support for most common data structures
*except* for serializable objects.
- If you had serializable object support in GLIB, you could easily add
serializability to most of the existing GLIB data structures, provided that
those data structures contain serializable objects or another serializable
data structure.

I think that it might make more sense just to add an object model to GLIB
optimized for runtime data storage flexibility (and with good RTTI) than to
try to make GTK's object model be all things to all people.  Some of the
pieces are already there; basically what's needed is the ability to create
structs at run time (including handling all of the field packing correctly)
and a set of functions and macros to enable fast and convenient access to
those structs' members.

This won't be as fast as compile-time structs, but I should be able to get
field accesses down to about the speed of an array access (if you're looking
up a struct member using its ID and not using its string name) which is
probably fast enough for nearly everything one might want to do in a desktop
app.

What do you think about this?


Regards,

Dave

--
David Orme                                       LINUX...
david@coconut-palm-software.com          ...it already goes there
http://www.coconut-palm-software.com               :-)





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]