Is it possible to use __set_pmc_keyed(_int|_str)? to
detect when a PMC object is being subscripted with an
integer versus a string argument?

In particular, I'd like to be able to detect the difference between
the keys used in the keyed assignments below:

    $P0 = new "MyClass"
    $I0 = 5
    $S0 = 'foo'

    $P0[$I0] = $P0                    # called with an integer key
    $P0[$S0] = $P0                    # called with a string key

I've tried defining "__set_pmc_keyed_int" and "__set_pmc_keyed_str"
but they seem to have no effect; Parrot seems to always want to
call "__set_pmc_keyed" regardless of what is placed in the brackets.

I've also tried variations of @MULTI, and they just seem to
result in segmentation faults:

    .sub __set_pmc_keyed method, @MULTI(int, pmc)
        .param int key
        .param pmc val
        ...
    .end

    .sub __set_pmc_keyed method, @MULTI(string, pmc)
        .param string key
        .param pmc val
        ...
    .end

Any clues, help, or pointers?  And of course I have similar
questions for the __get_pmc_keyed.* methods.  :-)

Thanks in advance,

Pm

Reply via email to