# New Ticket Created by  Timothy Smith 
# Please include the string:  [perl #114540]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=114540 >


class Foo {
    method foo {
        Proxy.new(
            STORE => method ($val) { note "STORE $val"; $val; },
            FETCH => method        { note "FETCH"; 'blaarg'; }
        );
    }
}

my Foo $f .= new;

note "Fetch is called multiple times (rakudo: 4, niecza: 2):";
say $f.foo;

note "Fetch is called multiple times (rakudo: 5, niecza: 2):";
$f.foo.say;

note "Fetch is called once:";
my $tmp = $f.foo;
$tmp.say;

Reply via email to