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

Robert Forshaw iouswuoibev at hotmail.com
Sat Jan 10 22:07:15 CET 2004


>From: Noah Gibbs <noah_gibbs at yahoo.com>
>   Since whether this works depends on how you call it,
>we don't really have enough information to go on here.
>  More to the point, we don't really want to verify a
>bunch of code that hasn't been tested.

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.

>   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.

>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, which is what gets destructed, and the 
recompiled version doesn't have a pointer. At least, that is what I thought.

>Also:  since your recompile() function calls itself,
>it's a bit much to call it on every item in the list.
>That means that any common parent classes (like,
>inherited by more than one parent of your object) will
>get recompile called on them repeatedly, which is
>wasteful, at least the way you've coded it.
>
>   Also, you're recompiling the parent before
>destructing it.  I think that you can't directly
>recompile an object if it has children.  I think you
>get an error.  Maybe that's just the Kernel Lib,
>though.

According to the comment (which is from /doc/Introduction in the 
distribution) this is not the case:
("If B should actually be recompiled (inheriting the new version of C from 
B), the driver object must destruct B"). Did I misinterpret that?

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger

_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list