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

Bart van Leeuwen bart at wotf.org
Sun Jan 11 01:29:10 CET 2004



On Sun, 11 Jan 2004, Robert Forshaw wrote:

> >From: Bart van Leeuwen <bart at wotf.org>
> >Lets go to the example of A inherits B and B inherits C
> >
> >You changed something in C and try to recompile C.
> >This will result in an error if you just call compile_object on it,
>
> Where abouts will the error occur and what will the error message be?

its a runtime error saying "Cannot compile inherited object", so I'd
expect it to appear wherever your runtime errors are going ;)

>
> >you will have to dest it and then compile it and you will have to updated
> >code
> >active.
> >No calls to recompile() will happen (yet)
> >
> >Now that you got your new code in C active, you want A to inherit the new
> >code. To do so, you recompile A by calling compile_object on it.
> >
> >Before A gets compiled, you will get a call to recompile() with B as its
> >argument. recompile() does its work and a NEW B is compiled, which
> >inherits the new C. Then A is compiled using the new B
> >
> >So, in the above example recompile() only gets called on B, and only
> >because C was updated.
> >
> >So, the condition for recompile() to get called is that you have a file
> >which itself is inherited, and which inherits an outdated version of
> >another library.
> >
> >To expand on the above example, lets consider A, which inherits B, which
> >inherits C, which inherits D. You change D and then upgrade it. Then you
> >upgrade A and as a result you get 2 calls to recompile() with B and C as
> >their arguments.
> >
> >I guess the confusion is due to the word recompile being used a bit
> >ambigiously throughout docs and conversation :)
>
> I understand now (*cheers*). It would seem though that if I want to update a
> library at the top of the chain (e.g. C in the first example) and have all
> its children updated automatically, I will have to write a lot more code,
> because I have to recompile every object from the bottom upwards in order to
> have them updated! I'm wondering if this is worth doing or whether I should
> do it 'by hand' (i.e. update the individual objects one by one that need
> it). I think a recursive function would be worth another look though if I do
> decide to make it possible to update everything that inherits an object
> automatically.

Yes you need code to handle that, and that code is far from trivial.
Some here will probably argue that you need to do it, I think it depends
on your environment, and I would not want all code to update itself
automatically like that, for one because I am not aware always of what
users of a library are doing at that moment, and they may have changes
pending themselves that do not compile yet or need to be compiled at a
specific moment.

I do want to have an overview of such objects tho, and I think you will
find yourself wanting the same if you do not decide for automatic
rebuilding of the entire tree.

Bart


> > _________________________________________________________________
> Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo
>
> _________________________________________________________________
> List config page:  http://list.imaginary.com/mailman/listinfo/dgd
>
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list