From: dblack@... Date: 2002-09-06T11:45:14+09:00 Subject: Re: Ruby aesthetics Hi -- On Fri, 6 Sep 2002, Albert Wagner wrote: > On Thursday 05 September 2002 12:08 pm, Christian Szegedy wrote: > > > What I really dislike in Ruby, that the data members are seen > > by the child classes. This is a very serious issue, and a claer > > violation of object-orientation. > > > > I think Ruby would be a much better language if the instance > > variables would only live per class and not per hierarchy... > > > > I don't understand what is bad about this. I typically depend on instance > variables in the parent(s) being directly accesssible. I think I understand the objection (thanks in large part to Holden's explaining it to me on irc). As I understand it, the problem is that if you do this: class A def initialize(x) @thing = x end def talk puts "My thing is #{@thing}." end end class B < A def talk puts "I have a thing which is #{@thing}." end end and then class A is rewritten so that @thing is renamed to @item, B will break. I've tended to see instance variables as part of the... well, I was going to say the interface, but that's wrong... part of the stuff you're allowed to know about. But I'm seeing that that's pretty non-robust. David -- David Alan Black | Register for RubyConf 2002! home: dblack@candle.superlink.net | November 1-3 work: blackdav@shu.edu | Seattle, WA, USA Web: http://pirate.shu.edu/~blackdav | http://www.rubyconf.com