Rick Delaney wrote:
> On Sep 04 2007, Michael G Schwern wrote:
>> I posted up a bug about problems with fields and
private keys.
>> h
ttp://rt.perl.org/rt3/Ticket/Display.html?id=44969
>>
>> In short: An inherited object can't use the
private fields of a parent *even
>> inside the parent's private method*.
>
> The problem is that restricted hashes fix the allowable
keys at the time
> they are locked, which in this case is fields::new().
I don't see how
> this can be fixed to work the way it did before.
>
> We could change things so that private fields are in
the set of allowed
> keys in the derived object. This would mean they would
no longer be
> strictly private but accesses with constant keys would
still get caught.
> So
>
> $base->; # ok
> $derived->; # rightly croaks at
compile-time
> $derived->{$private}; # wrongly accesses
private field
>
> I think this is an improved state of brokenness. What
do you think?
+1
"It works, but encapsulation can be violated" is
better than "it's broken" and
eliminates this as a showstopper.
--
Hating the web since 1994.
|