Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rakudo doesn't guarantee how often FETCH is called for S12-attributes/mutators.t #71

Closed
ronaldxs opened this issue Sep 25, 2015 · 1 comment

Comments

@ronaldxs
Copy link
Contributor

Besides other RT #124909 issues, FETCH can get called more than once.

I am sorry but I don't know how to open the issue for just that test file.

use v6;

#`{{
The problem is that with an $.attr type of Int FETCH is called twice
for one access to $.attr.
If you take away the type of Int $f_count returns 1 and bug goes away

According to timotimo "rakudo doesn't guarantee how often FETCH is called"
http://irclog.perlgeek.de/perl6/2015-09-25#i_11276252
}}

use Test;

plan 1;

our $f_count = 0;

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;
is($f_count, 1, 'fetch called more than once can be unexpected');
@ronaldxs ronaldxs changed the title rakudo doesn't guarantee how often FETCH is called rakudo doesn't guarantee how often FETCH is called for S12-attributes/mutators.t Sep 25, 2015
@ronaldxs
Copy link
Contributor Author

Actually S12-attributes/mutators.t was substantially revised and the issue with that roast test file can be considered closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant