[DGD] preserving vars after lib recompile

bart at wotf.org bart at wotf.org
Tue Sep 16 20:49:25 CEST 2008


Assuming the following situation:

library A compiled from /lib/a.c is only inherited, never used as an object in
its own right
object B compiled from /obj/b.c inherits /lib/a.c

When you destruct A and then recompile B (without destructing it) no data in
variables will get lost regardless of if they are defined in /lib/a.c or
/obj/b.c, unless you happen to remove variables from the code (so they no
longer exist in the resulting object)

The fact that you destruct A does not do anything to variables inherited from
it by B, those exist in the dataspace that belongs to B. 

If however A is also used as an object in its own right, any data in variables
for that object will get lost. This is one of the things that make attempts to
port more traditional libs to DGD and being able to take advantage of
persistence a lot more work then just porting to a slightly different LPC dialect.

At any rate, the old instance of A will continue existing until the last
program that inherits it is destructed or recompiled. 

When this happens a call to the driver object is made so it can do any
administration that might be needed. 

This may seem a bit strange since you destructed it, and indeed a
find_object() will not find it after the destruct. Internally, as a bit of
bytecode that is inherited by some objects it still exists however, as do any
variables it happens to define as part of the dataspaces of objects inheriting it.

Hope this helps :)


On Tue, 16 Sep 2008 09:30:32 -0700 (PDT), Noah Gibbs wrote
> This is a hard problem.  The Kernel lib solves it by not allowing 
> data in libraries if I remember correctly.  You could also have 
> upgrade scripts that saved off the data and reloaded it, but that 
> will be ugly -- every object will have to maintain those scripts or 
> upgrading will lose data...
> 
> --- On Tue, 9/16/08, chris . <psych_mayo at hotmail.com> wrote:
> 
> > From: chris . <psych_mayo at hotmail.com>
> > Subject: [DGD] preserving vars after lib recompile
> > To: dgd at dworkin.nl
> > Date: Tuesday, September 16, 2008, 8:17 AM
> > My understanding is that when i use an objectd to recompile
> > a lib, all the dependent files would be destructed and than
> > recompiled/recloned.  I want to preserve variables existing
> > in objects, whether or not they exist in that object or in a
> > lib the object inherits.
> > This issue has been discussed or worked on before i
> > presume, so i guess my first thought is to ask what other
> > people have done.
> > My ideas on the topic all involve writing an upgrade script
> > of some sort, for each object with variables to be saved. 
> > Ive ruled out using save/restore.  I dont know of a way to
> > check what variables exist for a given object.
> > Thanks.
> > chris
> > 
> > 
> > 
> > 
> > _________________________________________________________________
> > See how Windows connects the people, information, and fun
> > that are part of your life.
> > http://clk.atdmt.com/MRT/go/msnnkwxp1020093175mrt/direct/01/
> > ___________________________________________
> > https://mail.dworkin.nl/mailman/listinfo/dgd
> 
> ___________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd


--
Created with Open WebMail at http://www.bartsplace.net/
Read my weblog at http://soapbox.bartsplace.net/




More information about the DGD mailing list