... 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



Reply via email to