Juerd skribis 2005-04-28 14:47 (+0200):
> Yes, because a pair is an object (reference), and it's not the .value
> that you're passing ro.
An example of what would go wrong:
for %hash.pairs>>.value -> $value {
$value = ...;
}
But this will work:
for %hash.pairs>>.value {
$_ = ...;
}
And this again won't:
for %hash.pairs>>.value -> $_ {
$_ = ...;
}
This makes "upgrading" a block to use an explicit name a painful
experience if you happen to mutate its value, because you have to
specify 'is rw', which I'm sure will bite many people many times.
This is why I want <->, so that the default for
for ... { ... }
can be
for ... <-> $_ { ... }
rather than the unexpected
for ... -> $_ is rw { ... }
so that $_ is the default, and no special default-magic for "is rw" is
needed. Of course, "<-> $_" and "-> $_" are 100% equal internally.
Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
http://convolution.nl/gajigu_juerd_n.html