Am Montag, 2. April 2007 08:24 schrieb Allison Randal:
> The significant differences between the two are that Iterator's
> shift_pmc throws an exception if the iteration key is -1 while
> shift_string doesn't bother to check (it probably should), and
> shift_string calls VTABLE_get_string_keyed on the aggregate it contains,
> while shift_pmc calls VTABLE_get_pmc_keyed. And the only significant
> differences between Hash's get_string_keyed and get_pmc_keyed are to be
> expected for returning a string instead of a PMC.
The former is also implementing the Hash iteration internals. E.g.

        switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
            case KEY_hash_iterator_FLAGS:
             ...
                return parrot_hash_get_idx(INTERP, hash, key);

This implementation is somehow inside out and a bit weird. Earlier it was 
insider the iterator, but then the iterator had to know some internals of the 
hash to work, which was suboptimal too.

The major problem is probably, that there are no specific iterator interface 
vtable functions that an iterator would use.

leo

Reply via email to