[DGD] Recursion in recompile(), is this correct?

Noah Gibbs noah_gibbs at yahoo.com
Sat Jan 10 22:41:40 CET 2004


--- Robert Forshaw <iouswuoibev at hotmail.com> wrote:
> Perhaps you don't. That's not what I was
> asking. I just want to know if a 
> recursive call is necessary in order to update
> every object in the 
> inheritance hierarchy.

  DGD may call recompile() again on the parent classes
automatically when you call compile_object() on them. 
So this'll all be pretty weird.  I haven't tried it,
but I'd expect an infinite recursion in complicated
cases.  The right way to do this is probably to call
compile_object() yourself, but never recompile().  The
Kernel Library simply calls destruct_object(), never
compile_object(), but then the Kernel Library will
automatically compile libraries when you inherit them
so it may not need to.

> >   With that said:  I note that you are *always*
> >destructing the object, regardless of how the
> >recompile goes.  That's not what your comment says.
> 
> That's not my comment, it was from the docs.

  Ah, okay.  Then your code's just wrong, and will
give you an error the first time recompile gets
called.

> >So at the very least, your code and your comments
> >disagree.  It also seems a bit silly to bother
> >compiling the object if you're just going to
> destruct
> >it.
> 
> It is supposed to destruct the old copy. The obj
> variable holds a pointer to 
> the old version of the object,

  This won't work.  It turns out that an object
pointer is effectively to the latest version, always. 
When you recompile the code, the object pointers get
updated, kinda like how when you destruct an object
all pointers to it suddenly become nil.

  Each 'version' you're talking about is called an
'issue'.  You can't specifically touch an old issue,
not to recompile it nor to destroy it.  Object
pointers update automatically, so this code won't work
the way you're hoping.

  Remember what I said about this stuff not being
trivial?  You *have* looked at Geir Harald Hansen's
sample object manager, and at the Kernel Library
driver (/kernel/sys/driver.c), already.  Yes?




=====
------
noah_gibbs at yahoo.com

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list