From: Christian Szegedy Date: 2002-09-06T19:10:20+09:00 Subject: Re: Ruby aesthetics dblack@candle.superlink.net wrote: > Hi -- > > 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. > > No, my problem is that if you coin a new variable name (in this case @thing) in the derived class (B), than you can't be sure that it's not yet used. In a more realistic exaple you can have a deeper hierarchy and data memebers can be automagically generated by e.g. attr_accessor. So if if you grep and don't find any "thing" in your code, you can't be sure, that some generated method does not make use of it implicitely. The other problem is that the implementation of some base class (perhaps in an external module written by someone else, you reinstall sometimes) is changed to make use of @thing... The error possibilities are uncountable... Regards, Christian