From: Rich Kilmer Date: 2002-11-08T14:17:02+09:00 Subject: Re: Making Instace Variables Private/Local Let's see: Dave Thomas gave a presentation on a 26kloc production business system he wrote over the summer in Ruby. I have a project with about 10kloc's of Ruby controlling a distributed agent society of 40+ machines in a highly dynamic environment...being used every day. I never had a need with what you are asking for, and obviously Dave didn't. I think the main barrier to writing production systems in Ruby is people talking about why it cannot be done and not spending the time doing it. -Rich > -----Original Message----- > From: Gavin Sinclair [mailto:gsinclair@soyabean.com.au] > Sent: Thursday, November 07, 2002 6:30 PM > To: ruby-talk ML > Subject: Re: Making Instace Variables Private/Local > > > From: "William Djaja Tjokroaminata" [snipped] > > > > (In > > other words, whether you decide that it is perfectly fine > that a child > > class accesses its parent class data directly in terms of > '@var' and > > not > > 'self.var'.) > > > > > > Bill > > The only other OO (rather, OI - Object Influenced) languages > I know are C++ and Java. In both of these, derived classes > have access to parent classes' public > (obviously) and protected instance variables. > > It seems that the Ruby model is that all instance variables are a mix: > - protected, because children can access them; and > - private, because other objects of the same class *can't* > access them > > If C++ and Java allow derived classes to access parent's > instance variables, then why not Ruby? Granted, at least in > these languages, instance variables can be made genuinely > private, but I don't think it would make sense for Ruby to > make *all* instance variables private. > > In my (limited) experience, there is less need for > inheritance in Ruby than in > C++/Java, because dynamic binding takes place all the time, > and because > C++classes > can be modified. This is great, because in Ruby you only > inherit when it genuinely makes sense, rather than as a > convenience for modifying behaviour. A corollary of this is > that you should be able to manage your inheritence trees > sufficiently to avoid trampling on parent's data. Just my 2c. > > Gavin > > > >