Created
September 25, 2015 18:31
-
-
Save ronaldxs/4cb6bb2b47140eab390a 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
our $f_count = 0; | |
# If you take away the type of Int $f_count returns 1 and bug goes away | |
class C { | |
has Int $.attr is rw; | |
method attr returns Int is rw { | |
return Proxy.new( | |
FETCH => -> $self {$f_count++; 42 }, | |
STORE => -> $self, Int $new {}, | |
); | |
} | |
} | |
my C $c .= new; | |
my $a = $c.attr; | |
say 'count should be 1 but is: ', $f_count; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment