Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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