On Fri, May 09, 2008 at 03:02:28PM +0200, Carl Mäsak wrote:
> 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.

In Rakudo's case, we just haven't implemented read-only traits
on variables yet.  But yes, I expect that it will be caught as
a compile-time error.

Pm

Reply via email to