To get down to it, what I need is a way to find all the children of a specified object, and a way to find all the clones of a specified object.
For what purpose?
Currently the only way I can think about doing it is using programs and that is backwards: create a blank array, iterate through the list of programs, check what it inherits, save the pointer to the program in the array if it inherits Obj X, iterate again, etc. until through the whole list.
Programs can only inherit programs, not objects? Sounds complicated.
That just seems too much to me. Any help would be appreciated.
I would probably make the list myself, while the objects is being created.
void create() { global_add_me_to_the_list(this_object()); }
multiset list=set_weak_flag((<>),1); void global_add_me_to_the_list(object obj) { list[obj]=1; }
set_weak_flag will make sure garbage collection will still be functional, even though we have the object pointer. It will also remove all "lost" objects from the list automatically. (Neat, huh?)
If you have no control over how create is called, you could do it in "__INIT", the variable instantiation, which will always be called:
static int dummy=lambda() { global_add_me_to_the_list(this_object()); return 0; }();
/Mirar