# New Ticket Created by  Patrick R. Michaud 
# Please include the string:  [perl #48467]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=48467 >


Using assign with an Object causes it to create a Ref 
instead of assigning a copy.

For example, given the following Perl 6 code:

    my $x = 0;
    my $y = 3.2;
    $x = $y;
    $y++;
    say $x;              # outputs "4.2", should be "3.2"

Here's a PIR version of the code and its output:

    $ cat y.pir
    .sub main
        $P0 = subclass 'Float', 'Num'
   
        ##   my $x = 0;
        $P1 = new 'Integer'
        $P1 = 0
        .lex '$x', $P1
   
        ##   my $y = 3.2; 
        $P2 = new 'Num'
        $P2 = 3.2
        .lex '$y', $P2
   
        ##   $x = $y;
        $P3 = find_lex '$y'
        $P4 = find_lex '$x'
        morph $P4, 'Undef'
        assign $P4, $P3
   
        ##   $y++;
        $P5 = find_lex '$y'
        inc $P5
   
        ##   say '$x = ', $x;
        $P6 = find_lex '$x'
        print "$x = "
        say $P6
    .end

    $ ./parrot y.pir
    $x = 4.2

This problem is blocking completion of a few 01-sanity
tests -- for example, using typeof on a Ref object returns
'Ref' instead of the type of the referenced object.
This is blocking completion of 07-ref.t and 07-isa.t tests.

Resolving ticket #47828 (copy opcode) may also help with
this particular issue, but at the moment we're a bit stuck.

Pm

Reply via email to