From: Martin DeMello Date: 2003-06-26T05:46:55+09:00 Subject: Re: protect parents from children Simon Strandgaard <0bz63fz3m1qt3001@sneakemail.com> wrote: > On Wed, 25 Jun 2003 14:22:56 +0000, Martin DeMello wrote: > >> What if they override @initialize and don't call super - how does >> the value get set, then? > > I don't know which kind of behavier would be appropriate here? Me neither - again, note the problem of values attaching themselves to an instance, rather than a class. >> And don't forget they can simply reopen A and add a method of their own, >> then call it from B. > > I consider 'reopen'ing as a kind of subclassing. if subclass then its > readonly mode :-) I seriously doubt you can write a Ruby program capable of distinguishing between class A def foo; end def bar; end end and class A def foo; end end class A def bar; end end In fact, if there weren't so many ingenious people on the list, I'd go ahead and flatly say it was impossible :) martin