In article <[EMAIL PROTECTED]>,
Abigail <[EMAIL PROTECTED]> writes:
> And this shows the behaviour is a bug. Running
>
> $ perl -wle 'sub fun { print $_++ for reverse 1..3} BEGIN { fun}; fun'
>
> gives:
>
> 3
> 2
> 1
> 4
> 3
> 2
>
>
> But the code generated by Deparse doesn't compile; when the BEGIN is
> executed, it dies with "Modification of a read-only value attempted".
>
> "1 .. 3" should behave the same as "1, 2, 3", but it turns out it doesn't.
>
To an extent that's because deparse has no way to distinguish a
list filled with constants and a list with modifiable values, so
you could say it's a deparse weakness.
If 1..3 should be the same as 1,2,3 is more a taste issue.
Another way to solve it would be to keep them modifyable, but
reexpand 1..3 each time. Or you can just say "don't do that then".
(personally i actually agree with you. It seems something that can
be done relatively cheaply and it eleminates a "gotcha". See also
the numeric/string example in my previous post which I also think
should work)