[DGD] Dynamic inheritance

Risto Karjalainen risto.karjalainen at pp1.inet.fi
Sat Dec 22 00:17:47 CET 2001


I've been thinking of possible solutions for dynamic objects. By dynamic
objects I mean objects whose type can be altered arbitrarily on the fly, for
example changing a sword into a door, or even making it be both. One
possible solution would be to have an object inherit all the possible type
objects and have flags determine the type(s) of the object, then simply
cloning everything from it. But I think storing data that might never be
used is an outrageous waste of resources.

I also thought of another possible solution, which I call dynamic
inheritance. It would allow the adding and removing of programs that the
original object inherits without destructing or recompiling it, having
effect only on the desired clone, not all the clones. This way I could alter
the object very easily and almost limitlessly. Althought there might be
drawbacks and inconsistences that haven't occured to me. Are there?

I could (and probably will) simulate this kind of behaviour by having
objects have a list of relevant "inheritables." So if I want to change a
sword into a door, I simply clone a new door object and associate it with
the original object. By overriding call_other to loop through the object's
list on a call to a function in the object, I could make them behave as if
they were merely a single object. I mention this just to show that dynamic
inheritance is not necessary for gaining the same result.

Any ideas?

Regards,
Risto Karjalainen



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



More information about the DGD mailing list