[DGD] Re: Clones and very large arrays

Robert Forshaw iouswuoibev at hotmail.com
Tue Apr 6 16:38:29 CEST 2004


>we just empty the data structure (!). Why? Because DGD offers a second 
>method to enumerate all the clones of a given clonable, namly 
>find_object().
>
>Thus, for clonables with lots of clones, we return an iterator that reads 
>basically:
>
>
>string clonable;
>object next;
>int ix;
>
>static atomic
>void configure(string str) {
>    clonable = str;
>    ix = 1; forward();
>}
>
>int has_next() {
>    return !!next;
>}
>
>object next() {
>    if (next) {
>      object ob;
>
>      ob = next;
>      forward();
>
>      return ob;
>    }
>    error("read past end");
>}
>
>private
>void forward() {
>    while (ix <= status()[ST_OTABSZ]) {
>      next = find_object(clonable + "#" + ix);
>      ix ++;
>
>      if (next) {
>        return next;
>      }
>    }
>    next = nil;
>}

I have a few questions about this code, since I can't make head or tail of 
it:

what does status()[ST_OTABSZ] return?
Why is the function 'forward' void, yet it tries to return the variable 
next?
How is this function supposed to work?
Instead of storing a mapping of the clones up to a relatively small number 
and THEN using this iterator, why not use this iterator from the beginning?

_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger 
http://www.msn.co.uk/messenger

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



More information about the DGD mailing list