Hi, my ($a, $b, $c) = <a b c>; my $also_a := ($a,$b,$c)[0]; $also_a eq "a"; # correct? $also_a = "A"; # does not die? $a eq "A"; # true?
my $also_b = "b"; ($a,$b,$c)[1] := $also_b; $b eq "b"; # true? $b = "B"; # does not die? $also_b eq "B"; # true? Note that if my assumptions are correct, the following expressions must be true as well (also see [1]), unless there's some additional magic. ($a,$b,$c)[0] =:= $a; ($a,$b,$c)[1] =:= $b; ($a,$b,$c)[2] =:= $c; Thus: ($a,$b,$c)[1] = 42; # same as $b = 42 And: (0,1,2)[1] = 42; # dies ("cannot modify constant") (0,1,2)[1] := 42; # dies ("cannot rebind constant") my @foo = <a b c>; my @bar = <d e f>; (@foo,@bar)[2] =:= @foo[2]; # true (@foo,@bar)[3] =:= @bar[0]; # true (@foo,@bar)[2] = 42; # same as @foo[2] = 42 (@foo,@bar)[3] = 42; # same as @bar[0] = 42 (@foo,@bar)[2] := 42; # same as @foo[2] := 42 (@foo,@bar)[3] := 42; # same as @bar[0] := 42 (These questions were motivated by Flavio's work in progress [2] ("A draft on the runtime view of how Lazy things (like Arrays) work").) --Ingo [1] http://www.nntp.perl.org/group/perl.perl6.language/22924 [2] http://svn.openfoundry.org/pugs/docs/notes/laziness.txt