Moritz in the spec (>>), Damian (>):
>> After lengthy IRC discussion, we concluded that it's a good idea to provide
>> some form of introspection that doesn't bother about perceived privacy
>> borders, provided that the implementation makes it feasible.
>
> Wow, that's the first time I've ever been sorry not to be on IRC!
>
> Talk about snatching (directly accessible) defeat from the jaws of
> (encapsulated) victory. :-(

For what it's worth, we had exactly this discussion a couple of days
ago on IRC. I represented your views above, Damian.

 <http://irclog.perlgeek.de/perl6/2010-09-22#i_2852991>

To summarize, I consider myself having lost that debate. I even
demonstrate the complete unviability of my views (that privacy has any
kind of footing in Perl 6) with the below one-liner.

<masak> rakudo: class X { has $!foo; has $!bar; has $!baz }; say
eval(X.new( foo => 1, bar => 2, baz => 3).perl.subst("X.new(", "\{
").subst(/\)$/, " }")).perl
<p6eval> rakudo 8156be: OUTPUT«{"foo" => 1, "bar" => 2, "baz" => 3}␤»

As long as C<.perl> works the way it does, there can be no real
privacy. And thus C<.get_value> and C<.set_value> are just convenient
access points for the same behaviour.

> Could we at least specify that .get_value() and .set_value() can only
> be called if the calling scope declares a C<use MONKEY_TYPING;>
> so that violations of good OO practice are explicitly marked in a
> consistent and easily searched-for manner?

I'm still undecided on whether or not I think C<use MONKEY_TYPING;> is
the right way to enable this kind of privacy breakage. Maybe nothing
is needed, since the C<^> in C<$obj.^attributes> (or the C<HOW>)
already says "warning! meta!".

// Carl

Reply via email to