Created
May 10, 2016 20:17
-
-
Save ufobat/b32e882564057ead07de146b51672a9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Strange { | |
has $.env is rw; | |
method reset($env) { | |
$.env = $env ; | |
} | |
} | |
class Context { | |
has $!env; | |
has $.strange = Strange.new; | |
method env { | |
Proxy.new( | |
FETCH => { $!env }, | |
STORE => -> $, $value { | |
# reset response to default | |
$!env = $value; | |
$!strange.reset($!env); | |
}, | |
); | |
} | |
} | |
my %env = (1 => 2, 3 => 4); | |
my $c = Context.new; | |
sub dispatch($v) { | |
$c.env = $v; | |
} | |
dispatch(%env); | |
dispatch(%env); |
m: class Strange { has $.env is rw; method reset(
rakudo-moar 9c8989: OUTPUT«Cannot assign to a readonly variable or a value in method reset at /tmp/plljs3r5Zt line 1 in block at /tmp/plljs3r5Zt line 1»
soo, it's a bug?
pretty sure it is, yes
care to submit it? :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cannot assign to a readonly variable or a value
in method reset at Strange.pm line 4
in block at Strange.pm line 18