Re: Hash iteration question

2007-04-03 Thread Leopold Toetsch
Am Dienstag, 3. April 2007 06:56 schrieb Allison Randal: > > The major problem is probably, that there are no specific iterator > > interface vtable functions that an iterator would use. > > Isn't that what nextkey_keyed is for? Though, looking at it, it seems > more like part of the problem of ent

Re: Hash iteration question

2007-04-02 Thread Allison Randal
Leopold Toetsch wrote: 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); Yeah, that part's pretty

Re: Hash iteration question

2007-04-02 Thread Leopold Toetsch
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

Re: Hash iteration question

2007-04-01 Thread Allison Randal
Jonathan Worthington wrote: Hi, Earlier tonight I tried to iterate a hash. I have somewhat thoughtlessly been doing things like: PMC *iter = VTABLE_get_iter(interp, some_hash); while (VTABLE_get_bool(iter)) { PMC *key_pmc = VTABLE_shift_pmc(interp, iter); STRING *key = VTABLE_get_stri

Hash iteration question

2007-04-01 Thread Jonathan Worthington
Hi, Earlier tonight I tried to iterate a hash. I have somewhat thoughtlessly been doing things like: PMC *iter = VTABLE_get_iter(interp, some_hash); while (VTABLE_get_bool(iter)) { PMC *key_pmc = VTABLE_shift_pmc(interp, iter); STRING *key = VTABLE_get_string(interp, key_pmc); ... }