I have some questions about Pair objects.  Synopsis 2 currently
shows Pairs as being immutable, but there are a few places in
the test suite that expect to modify the value component of a 
Pair, so I'm asking here:

(1)  If I use .pairs to obtain a list of Pairs from an array or
hash, are the values of those Pairs references to the original
elements or copies of them?

For example, after

    my @list = (1,2,3);
    for @list.pairs { .value += 10; }

does @list contain 1,2,3 or 11,12,13 ?

(2)  If I build a Pair using infix:«=>», is the value portion
of the new pair modifiable -- i.e., can it act as an lvalue?  
If it can be an lvalue, is it really a reference to the original 
value?

    my $x = 12;
    my $p = (key => $x);

    $p.value += 10;          # valid?  If valid, is $x modified?

Pm

Reply via email to