From: William Djaja Tjokroaminata Date: 2002-11-09T00:52:27+09:00 Subject: Re: Making Instace Variables Private/Local Rich Kilmer wrote: > 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 Well, it is not about not spending the time doing it; I want to do it, but to do it *in the right way*. Really, for a one-person project, if he/she overwrite his/her own variable of the same name, it is his/her own problem. But in multi-person project, with a stratagey of, for example, one person is responsible for one class in a inheritance tree, the "protected" instance variables can only cause bugs. (This problem IMO is the very reason Matz was considering the creation of class local variables.) If I am the project manager, I will enforce this to my subordinates: when the class local variables are available, then everyone will use only class local (private) variables, and child classes will access the parent's data using methods, never the variables directly. In this way there is no risk of bugs because someone by accident creates an identical variable name. Also, we can change the implementation of a parent class by changing the instance variables (but not the methods) without breaking any child classes. However, if a rule is only a rule specified by people, and not enforced by the language itself, then it is not good. People can still abuse it (either intentionally or accidentally). An example is of course C++. I really want to sell Ruby to the corporate world, but I do not like to follow the Perl path, but instead I prefer the Java path. I want Matz's picture to be on the cover of Time magazine and not just Linux Journal magazine (such as Larry Wall). Regards, Bill