Created
March 12, 2011 23:48
-
-
Save jnthn/867713 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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