TSa (>): > sub bar ($x) > { > $x = 3; # error, $x is readonly > foo($x); # error, could hit rw Str > }
By the way, I hope it's possible to make the assignment `$x = 3` to the read-only variable $x a compile-time error. In fact, I hope this to such a degree that I would like it to be part of a spec somewhere that a conforming Perl 6 compiler disallows assignments to read-only variables. I find nothing to this effect in S04 (but my grep-fu is imperfect, so I may just have missed it). Pugs currently dies with a run-time error on this. Rakudo r27392 runs it fine and sets $x = 3 as if $x wasn't read-only. // Carl