On Mon, Apr 22, 2002 at 05:40:09PM +0100, Piers Cawley wrote: > Does anyone have an idea of when we're going to see these? Or hashes > of PMCs, I don't really care which...
Well, we don't have hashes of anything. We already have arrays of PMCs. You just can't get the PMCs out, only their integer or numeric values. :-) True arrays of PMCs should probably be blocked on the whole keyed thing. Keyed access is partially implemented, but there's way too much manual code repetition at the moment, and the assembly syntax is wrong: EVENTUAL CURRENT set I0, P0[7] get_keyed I0, P0, 7 set P0[7], I0 set_keyed P0, 7, I0 set P0[0], P1[1] not possible set I0, P0[P1] not possible -- I'm not even sure what this will do set P1, P0[7] get_keyed P1, P0, 7 (requires the recently committed patch) set P0[7], P1 set_keyed P0, 7, P1 (requires the recently committed patch) So far, I've just kind of thrown in more and more [sg]et_keyed variants as they were needed. To continue in this grand tradition, I've just committed a patch to allow getting and setting of the PMCs in arrays. However, I'm not really sure how 'set P0[7], P1' is supposed to behave. I just overwrite the whole P0[7] array slot, discarding the previously held PMC. I don't remember the whole 'set P0, P1' discussion well enough to venture an opinion on whether the previous occupant gets to have a say in what happens. This code now works: # P0 is initialized to an array containing the command-line arguments new P1, PerlArray set_keyed P1, 0, P0 # set P1[0], P0 get_keyed P31, P1, 0 # set P31, P1[0] get_keyed S0, P31, 0 # set S0, P31[0] print "Command name: " print S0 print "\n" end