> Parameters are by default constant within the block. You can
> declare a parameter read/write by including the "C<is rw>" trait.
> If you rely on C<$_> as the implicit parameter to a block, then
> then C<$_> is considered read/write by default. That is,
> the construct:
>
> for @foo {...}
>
> is actually short for:
>
> for @foo -> $_ is rw {...}
>
> so you can modify the current list element in that case. However,
> any time you specify the arguments, they default to read only.
OK, so explicit params are const, and implicit $_ is rw.
There's another type of implicit arg: placeholders. is $^a "const", or "rw",
by default? is there any way to control it?
Is $_ always rw, or only rw when there are no args. I.e.
for @a -> $a {
$a ++; # error: $a is const
$_++; # increments $a, because $_ is implicitly bound to the same elem
as $a?
$^a++; # Can we mix placeholders with explicit args? Is this also bound
to $a's element?
}
Dave.