[comp.lang.c++] Object save/restore

niklas@appli.se (Niklas Hallqvist) (04/07/91)

lerman@stpstn.UUCP (Ken Lerman) writes:

>1 -- It is possible to save and restore arbitrarily complex graphs of
>objects without explicit cooperation from each class.  This is done in
>Objective-C.

No argument.

>2 -- It IS necessary (IMHO) that each object be able to identify
>itself.  In Objective-C, this is done by having an instance variable
>(called isa) which points to a class structure which contains the
>name, the types of instance variables, ... , for that class.

>The construction of that structure requires compiler support.

What I'm concerned about here is the excess luggage for objects not needing
this feature.  (e.g. An integer class, small but heavily used.)

>3 -- It is NOT necessary that each class in Objective-C have the same
>root class, but it IS necessary that each have a first instance
>variable which is the "isa" pointer.

Is this isa member always there, or is it possible for the user to decide.

>4 -- I don't understand the aversion to having a single root class for
>those objects which we wish to make persistent.  It seems to me that
>multiple inheritence might be good for this.  (If it is not good for
>this, what is it good for?)

Agreed! I've done this using MI and it works.  But the problem is:
Since there is no standard way to accomplish this task, it will by
reinvented again and again.  The fact that lots of companies want to
make binary distributions of class libraries, calls for some standard
way of achieving this will be made.  As a side note to those interested
in my MI-iplementation of object store/restore:  It's not really a
good solution, just an experimental hack never used outside the experiments.
It uses some classes from GNU libg++.

>If you believe our customers, the ability to save and restore object
>graphs is valuable.  At least for applications written in Objective-C.

This should be true in the C++ world as well.  I suppose that it is
equivally important to send/recieve object graphs over networks.
This calls for machine independent representation and possibilities
to recieve object graphs in a serial-only fashion (i.e. no seeks).

>This is NOT intended to tell you to change your language to match
>mine.  But if you want to add this functionality, experience with
>Objective-C might be valuable.

I suppose that is correct.  Objective-C sounds OK to me, but the fact
of the wide-spread use of C++, and the (possibly misunderstood)
dynamic typing of Objective-C makes me use C++.

>Ken

				Niklas

-- 
Niklas Hallqvist	Phone: +46-(0)31-40 75 00
Applitron Datasystem	Fax:   +46-(0)31-83 39 50
Molndalsvagen 95	Email: niklas@appli.se
S-412 63  GOTEBORG, Sweden     mcsun!sunic!chalmers!appli!niklas