Skip to content

Instantly share code, notes, and snippets.

@0racle
Forked from gfldex/fake-trust.raku
Created March 28, 2022 21:56
Show Gist options
  • Save 0racle/72639a88f53b247ac20f8b1a580a46f0 to your computer and use it in GitHub Desktop.
Save 0racle/72639a88f53b247ac20f8b1a580a46f0 to your computer and use it in GitHub Desktop.
use v6.d;
class A {
has $!a = 'private';
method !a { $!a }
}
multi sub trait_mod:<is>(Mu:U \obj, :$spying!) {
A.^add_trustee(obj);
A.^compose;
}
class B is spying(A) {
has A $.a = A.new;
method m { say $!a!A::a }
}
B.new.m;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment