Carl Mäsak wrote:
Carl (>>>>), Moritz (>>>), Carl (>>), Moritz (>):
<masak> um, so 'protected' is when the deriving classes can see the attribute?
<jonalv> yup
<masak> that's what 'private' means in Perl 6.
That's wrong. Perl 6's "private" is like Java's "private" - subclasses
can't see it.
It's just Rakudo being leaky at the moment, not a fallacy of the Perl 6
language. (Yes, we have failing tests for this; no, we don't run them at
the moment).
That is indeed reassuring. Thank you.
...So, how come Perl 6 doesn't have a 'protected' access level? :)
Exactly for the reasons you brought up against 'protected' as a default:
in encourages people to inherit from a class just to bypass some of the
public API.
Yes, but 'protected' can still be useful in some delimited situations.
I wasn't asking why it isn't the default -- I was wondering why it
isn't there at all.
The conversation we had on IRC
(<http://irclog.perlgeek.de/perl6/2010-03-23#i_2144261>) seems to
indicate that 'protected' can be emulated with the 'trusts' keyword...
but that doesn't have any explicit support from the spec, 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