Created
August 24, 2016 03:11
-
-
Save BenGoldberg1/20888ffacad74d4707ab1cfa7c6d32aa 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
# From https://docs.perl6.org/routine/trusts.html | |
class B {...}; | |
class A { | |
trusts B; | |
has $!foo; | |
method !foo { return-rw $!foo } | |
method perl { "A.new(foo => $!foo)" } | |
}; | |
class B { | |
has A $.a .= new; | |
method change { $!a!A::foo = 42; self } | |
}; | |
say B.new.change; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment