Skip to content

Instantly share code, notes, and snippets.

@ronaldxs
Created September 25, 2015 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ronaldxs/4cb6bb2b47140eab390a to your computer and use it in GitHub Desktop.
Save ronaldxs/4cb6bb2b47140eab390a to your computer and use it in GitHub Desktop.
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