Carl Mäsak wrote:
Carl (>>), Darren (>):
[...] and the
'trusts' keyword hasn't been realized in any Perl 6 implementation so
far.
I seem to recall that Pugs did support 'trusts' a few years ago, and that I
used it. But I could be wrong. -- Darren Duncan
I stand corrected. A quick search through the Pugs sources shows that
Pugs at least parses the 'trusts' declaration.
I didn't get it to trust me, though:
<masak> pugs: class A { has $!foo }; class B { trusts A; method bar(A
$a) { say $a!foo } }; B.new.bar(A.new(:bar(42)))
<p6eval> pugs: OUTPUT«»
Either it bitrotted or I'm using it wrong.
You're using it wrong. You need to put 'trusts B;' in A in order for B to see
A's privates. I hope it is obvious why this is the case. -- Darren Duncan