Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created March 12, 2011 23:48
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 jnthn/867713 to your computer and use it in GitHub Desktop.
Save jnthn/867713 to your computer and use it in GitHub Desktop.
# Remove the is repr('HashAttrStore') to see normal Perl 6 semantics
# (it prints nothing as the $!a is separately stored per class). With
# it in, this prints 42.
class Foo is repr('HashAttrStore') {
has $!a;
method foo() { $!a := 42 }
}
class Bar is repr('HashAttrStore') is Foo {
has $!a;
method bar() { say($!a) }
}
my $x := Bar.new();
$x.foo();
$x.bar();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment