On Fri, Jan 10, 2003 at 08:38:50AM +0900, Tom Sawyer wrote: > On Thursday 09 January 2003 03:57 pm, Mauricio FernáÏdez wrote: > > That would not happen if accessors were, say, protected by default. But > > then you'd have to 'publicize' them anyway, and the situation wouldn't > > be that different from the current one. > > > > OTOH if instance variables were private (not accessible by subclasses) > > all this would be much more relevant. I really felt that this was > > The Right Thing but matz doesn't [55201]. I think the main point was > > that inheritance is anyway a very strong relationship, so this apparent > > breach in data hiding is not that important. > > that's it! that's it! i've been pulling my hair out since the beginning of my > rubyist days deciding when it is the Right Thing to use @var vs. self.var. > And finally it has become clear! the answer is simple: NEVER USE @ OUTSIDE A > GETTER OR SETTER METHOD. what, you say? indeed! in fact, with use of the Then take into account that this goes against matz's word [55201], for if @var were never to be used, it would not exist in the language and instance vars. would be class-local by default. I have to ponder about this some more, but I have the feeling @iv is needed sometimes. -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com /* * Please skip to the bottom of this file if you ate lunch recently * -- Alan */ -- from Linux kernel pre-2.1.91-1