I'm having some trouble accessing elements of multidimensional arrays from PIR, and I'm not sure if what I want to do is buggy or unimplemented, or if I'm simply doing it the wrong way.
I have no problem accessing a one-dimensional Array with either an integer index, or with a PMC index of type Integer: .sub "main" :main # Set up an array ["zero", "one"] .local pmc array array = new .Array array = 2 array[0] = "zero" array[1] = "one" # print the final element (prints "one" as expected) $S0 = array[1] print $S0 print "\n" # print the final element another way (prints "one" as expected) $P0 = new .Integer $P0 = 1 $S0 = array[$P0] print $S0 print "\n" .end But if I try the same thing with an Array of Arrays, I can use literal integers for the Array offsets, but not Integer PMCs: .sub "main" :main # Set up an array of arrays [["zero", "one"], ["two", "three"]] .local pmc array, subarray1, subarray2 subarray1 = new .Array subarray1 = 2 subarray1[0] = "zero" subarray1[1] = "one" subarray2 = new .Array subarray2 = 2 subarray2[0] = "two" subarray2[1] = "three" array = new .Array array = 2 array[0] = subarray1 array[1] = subarray2 # print the final element (prints "three" as expected) $S0 = array[1; 1] print $S0 print "\n" # print the final element another way $P0 = new .Integer $P0 = 1 $P1 = new .Integer $P1 = 1 $S0 = array[$P0; $P1] # [1] print $S0 print "\n" .end The above code aborts with "build_key: wrong register set" at [1]. Can I use multi-dimensional PMC keys from PIR? There are opcodes like "new_key" and "set_key" in pdd06, but they don't appear to be implemented. Or should I be building the key myself by using the ".Key" PMC? Regards, Roger Browne