Skip to content

Instantly share code, notes, and snippets.

@BenGoldberg1
Created August 24, 2016 03:11
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 BenGoldberg1/20888ffacad74d4707ab1cfa7c6d32aa to your computer and use it in GitHub Desktop.
Save BenGoldberg1/20888ffacad74d4707ab1cfa7c6d32aa to your computer and use it in GitHub Desktop.
# 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