I just spent some time debugging a problem which turned out to be due to the "set" operator not doing what I expected (i.e., calling pmc_set). In retrospect, what set id doing is perfectly defensible, but "setref", as implemented by PerlScalar, remains counter intuitive, at least to me:

.sub main @MAIN
    $P0=new PerlInt
    $P0=1

    $P1=new PerlInt
    set $P1, $P0

    $P2=new PerlInt
    setref $P2, $P0

    $P0=2

    print "$P1 = "
    print $P1
    print "\n"

    print "$P2 = "
    print $P2
    print "\n"
.end

- Sam Ruby

Reply via email to