Skip to content

Instantly share code, notes, and snippets.

Created August 2, 2015 17:57
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 anonymous/634aa3faecd763e77966 to your computer and use it in GitHub Desktop.
Save anonymous/634aa3faecd763e77966 to your computer and use it in GitHub Desktop.
use v6;
class A {
has $.a is rw;
method a is rw {
Proxy.new(
FETCH => method () { $!a },
STORE => method ($v) { $!a = $v }
);
}
}
my $o = A.new;
$o.a = 123;
say $o;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment