[DGD] Re: Clones and very large arrays
Robert Forshaw
iouswuoibev at hotmail.com
Tue Apr 6 17:18:09 CEST 2004
>From: Par Winzell <zell at skotos.net>
>>Well like I said, I'm having difficulty making sense of it. The only loop
>>in the entire code will break as soon as it finds the first object (the
>>while() statement in forward()). And there isn't any recursion. So I'm not
>>sure how it is returning the entire list of clones.
>
>An iterator is used as this:
>
> while (iterator->has_next()) {
> log("The next object is: " + iterator->next()->query_name());
> }
>
>On each call to next(), the iterator should return the next object in the
>enumeration. It doesn't return an array or anything like that. It's an
>iterator the same way a for loop is an iterator -- it keeps an index of
>some kind internally, so that the code that uses it doesn't have to bother
>with such things.
I see; I read up "iterator" on everything2.com, but I had trouble placing
how it would work. So I took the (wrong) assumption that it was some kind of
loop. Thanks for straightening that out.
>Right -- in e.g. /base/obj/thing#283445, the number 283445 has nothing to
>do with how many clones of /base/obj/thing there are in the game. It's not
>"clone number 283445", it's "object number 283445, oh and it is also a
>clone of /base/obj/thing".
There goes another one of my wrongly mis-held assumptions. Now things make
more sense!
>
>If you wanted, you could keep a global "this is the highest clone number we
>have seen yet" number, if you really wanted, or maybe one per clonable. In
>practice it's not that big a deal I think.
I would still imagine that enumerating a mapping-of-mappings would be
quicker than a few hundred-thousand loops, but in practice... well, I
haven't had any yet.
_________________________________________________________________
Express yourself with cool emoticons - download 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