Skip Menu |
Report information
Id: 126120
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: elizabeth <liz [at] dijkmat.nl>
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Cannot change native role attribute from consuming class
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
Date: Sun, 20 Sep 2015 19:34:18 +0200
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 485b
[19:22:03] <lizmat> m: role R { has int $!a }; class A does R { method a() { $!a = 42 } }; say A.new.a # sigh [19:22:03] <+camelia> rakudo-moar 97e47a: OUTPUT«Cannot assign to an immutable value␤ in method a at /tmp/xjfoxVcXDh:1␤ in block <unit> at /tmp/xjfoxVcXDh:1␤␤» [19:22:25] <lizmat> m: role R { has Int $!a }; class A does R { method a() { $!a = 42 } }; say A.new.a # works fine if it is not a native [19:22:25] <+camelia> rakudo-moar 97e47a: OUTPUT«42␤»
Still reproducible (2017.11,HEAD(e5b660e))

On 2015-09-20 10:34:34, elizabeth wrote:
Show quoted text
> [19:22:03] <lizmat> m: role R { has int $!a }; class A does R {
> method a() { $!a = 42 } }; say A.new.a # sigh
> [19:22:03] <+camelia> rakudo-moar 97e47a: OUTPUT«Cannot assign to an
> immutable value␤ in method a at /tmp/xjfoxVcXDh:1␤ in block <unit>
> at /tmp/xjfoxVcXDh:1␤␤»
> [19:22:25] <lizmat> m: role R { has Int $!a }; class A does R {
> method a() { $!a = 42 } }; say A.new.a # works fine if it is not a
> native
> [19:22:25] <+camelia> rakudo-moar 97e47a: OUTPUT«42␤»




This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org