At 08:18 PM 9/4/00 -0400, Chaim Frenkel wrote:
> >>>>> "PRL" == Perl6 RFC Librarian <[EMAIL PROTECTED]> writes:
>
>PRL> =head2 Freezing state for keys and values efficiently
>
>PRL> I believe this problem can be solved by using the vtable for the
>PRL> hash to wrap any mutating functions with a completion routine that
>PRL> will advance the iterator to completion, creating a temporary list
>PRL> of copied keys/values that it can then continue to iterate over.
>
>Have versioned hash entries. Iterators would know what version of the
>hash they are operating on.
>
>This could be a lot more efficient than modifying the vtbl and filling
>up the stack with the keys. I really am suspicious of replacing the
>vtbl entry, there may be more than one thread working its way through
>the hash.

Or have a "next" vtable function that takes a token and returns the next 
entry in the variable. Each iterator keeps its own "current token" and the 
variable's just responsible for figuring out what should get returned next.

We could also have a "prev" entry to walk backwards, if we wanted.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to