From: William Djaja Tjokroaminata Date: 2002-11-12T02:46:20+09:00 Subject: Re: Making Instace Variables Private/Local Hi Yohanes, Yohanes Santoso wrote: > Well, you could try the untested code below to privatise parent's > instance variables. You'll need Wayne Conrad's stack frame patch: > http://yagni.com/stack_frames/index.php Thanks for the code. > But, really, humans (programmers) must bear some responsibility. The > situation is like the interface. You can define interfaces, but those > who implement them are not guaranteed to give the functionality you > expect. > Like (java): > interface Consume { > public void eat(); > } > class Human implements Consume { .... }; > class IOStream implements Consume { ... }; > Both classes implement two methods with the same name, but totally > different behaviours. So, in the end it's still the programmers' > responsibility to make things sensible. I totally agree with you. I just want the language itself to provide more protection for the human programmer, especially for the "innocent/accidental" mistakes. Just like C++, we have Meyers' "Effective C++ Ways", but we still can get pointer errors; on the other hand, in Java there is no way we will get pointer error (in the C sense). Similarly in Ruby, if all instance variables are class local/private, then I have one fewer thing to worry about in a multi-people projects. Regards, Bill