Metaobject that supports trust relations between types
is SuperClass
Warning: this role is part of the Rakudo implementation, and is not a part of the language specification.
Normally, code in a class or role can only access its own private methods. If another type declares that it trusts that first class, then access to private methods of that second type is possible. Metamodel::Trusting
implements that aspect of the Raku object system.
;A.build-and-poke; # Private method in B
method add_trustee(, Mu )
Trust $trustee
.
method trusts( --> List)
Returns a list of types that the invocant trusts.
;say .^name for A.^trusts; # Int
method is_trusted(, )
Returns 1 if $type
trusts $claimant
, and 0 otherwise. Types always trust themselves.