On Wed, 25 Jun 2003 13:29:31 +0000, Martin DeMello wrote:

> Simon Strandgaard <0bz63fz3m1qt3001 / sneakemail.com> wrote:
>> In C++ private members is inacessable to derivatived classes.
>> I want the same, but with a extra twist.
>> Instances declared in the parent should be readonly(frozen) to the
>> subclass.
>> 
>> So that the subclass (B):
>> *  is allowed to read the variable.
>> *  is disallowed to write to the variable (raise exception).
> 
> Offhand, I'd say it wasn't even hackable in pure ruby, because

[snip]

I am sad to hear that. Then I have to learn to live without protection.
Thanks Guy+Martin for the discussion it has been educational.


BTW: Perhaps it could be nice if you could say:

class A
  def initialize
    @value = [1, 2, 3]
  end
  subclass_freeze :value      # maybe nice to have ?
end

--
Simon Strandgaard