trusts
ErrorsCollection

trusts

Synthesised documentation from language/typesystem type/Metamodel/Trusting

From language/typesystem

See Original text in context

To allow one class to access the private methods of another class use the trait trusts. A forward declaration of the trusted class may be required.

class B {...};
class A {
    trusts B;
    has $!foo;
    method !foo { return-rw $!foo }
    method raku { "A.new(foo => $!foo)" }
};
class B {
    has A $.a .= new;
    method change { $!a!A::foo = 42self }
};
say B.new.change;
# OUTPUT: «B.new(a => A.new(foo => 42))␤»

From type/Metamodel/Trusting

See Original text in context

method trusts($type --> List)

Returns a list of types that the invocant trusts.

class A { trusts Int};
say .^name for A.^trusts;       # Int