On 03/26/2010 04:16 PM, Jason Switzer wrote:
Also, this discussion of "trusts" piqued my interest; this sounds like a bad
idea. Those of you who have worked extensively with C++ should bemoan
"trusts" as much as friend classes. They break encapsulation for special
cases, almost encouraging truly hideous object models that ultimately become
purely public (painful on a large scale). I can't stress enough that if
these are of similar nature, "trusts" should be removed. I'm all ears though
if someone knows of a reason why they're more useful than onerous.
-Jason "s1n" Switzer
Here's the C++ FAQ Lite's answer to that:
http://www.parashift.com/c++-faq-lite/friends.html#faq-14.2
I'm not necessarily sure that this applies to Perl 6 too much (I really
haven't paid a ton of attention to access control), but I've always
considered C++'s friends to be roughly equivalent to Java's
package-private in terms of where they fit into one's notion of
encapsulation - this is not to say that they are the same thing!
Sean Hunt