I think if you have the op for dereferencing, you don't need the additional ops for getting the type of the reference. Maybe in a typed VM it would make sense, but in Parrot, everything is a reference to a PMC, and a PMC knows what type it is.
At least that is my opinion. I think the deref op makes sense, but not the "ref type" ops. Just deref it to a P register and use the existing typeof op on it directly. For a ref to a ref to a ref you'd have to do that anyway. -Melvin Leopold Toetsch <[EMAIL PROTECTED]> 10/08/2003 11:12 AM To: P6I <[EMAIL PROTECTED]> cc: Subject: References ... ... are autogenrated sice some time. They delegete all but a few methods to the refered PMC. [1] But there are some pieces missing IMHO: There is no means to get at the type of what the Ref refers too. And we can't dereference the ref. I'm thinking of 2 new ops: deref Px, Py # set Px to what Ref Py refers to ref S0, Py # := typeof S0, Py->referee ref I0, Py # := typeof I0, Py->referee The "deref" opocde could call vtable->get_pmc, which isn't covered by any opcode yet (assign does a set_pmc - but we don't have the opposite). This could be also useful for Keys. We can do: new P0, .Key new P1, .PerlString set P1, "key" assign P0, P1 But there is no opcode to get the PerlString out of the key. Comments welcome, leo [1] new P1, .PerlString set P1, 42 new P0, .Ref, P1 print P0 print "\n" inc P1 # or inc PO print P0 print "\n" typeof S0, P0 print S0 print "\n" typeof S0, P1 print S0 print "\n" end 42 43 Ref PerlInt