>>>>> "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes:

  DS> I'm currently leaning towards having a "next" entry in the vtable
  DS> that takes a key value and returns the next entry in the
  DS> (hash|array|sparse array|bitmap|string) and leave it at that. No
  DS> state per se--if the key we're passing in doesn't exist it doesn't
  DS> much matter--we find where it would be and get the next one.

hmm, that means 'next' does a lookup based on the key passed
in. currently next uses the iterator state which is much faster. i think
next should be faster than a regular lookup but the semantics don't
specify that. your idea still fails when the hash gets modified during
iteration (does any iterator survive munging during iteration? other
than full copies?)

  DS> Of course stateless iterators have their own problems, but I don't
  DS> think that we have any good options, just a list of mildly
  DS> unpalatable ones.

i agree. but we all seem to want better than we have now. i think
stateful is good but probably only in external iterators. just having
that will solve most of the iterator problems we see. munging during
iteration is bad in general and should be forbidden.

so to recap my previous letter, let's keep one stateful iterator
attached to the hash, and support external (stateful?) iterators on
demand. other than munging during iteration, IMO that solves most (%99+
?) of the iteration issues.

uri

-- 
Uri Guttman  ---------  [EMAIL PROTECTED]  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com

Reply via email to