This is a known issue, as there is no native support for attribute binding this 
way.  There’s quite some code in the setting working around this issue  :-(

> On 15 Sep 2016, at 20:49, Zoffix Znet (via RT) <perl6-bugs-follo...@perl.org> 
> wrote:
> 
> # New Ticket Created by  Zoffix Znet 
> # Please include the string:  [perl #129278]
> # in the subject line of all future correspondence about this issue. 
> # <URL: https://rt.perl.org/Ticket/Display.html?id=129278 >
> 
> 
> #Doesn't work:
> <TestNinja> m: class { has int $!n = 0; method x ($!n) {} }.new.x: 42
> <camelia> rakudo-moar 2c95f7: OUTPUT«Cannot modify an immutable int␤  in 
> method x at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
> 
> # But does, if we use a temp var:
> <TestNinja> m: class { has int $!n = 0; method x ($n) {$!n = $n} }.new.x: 42
> <camelia> rakudo-moar 2c95f7: ( no output )

Reply via email to