Create a gist now

Instantly share code, notes, and snippets.

Embed
Perl6 hangs on Proxy referring to self
class c {
sub double() is rw {
my $storage = 0;
Proxy.new(
FETCH => method () { say self.WHAT; $storage * 2 },
STORE => method ($new) { $storage = $new },
)
}
method m {
my $doubled := double();
$doubled = 4;
say $doubled; # OUTPUT: «8␤»
}
}
c.m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment