From: "David A. Black" Date: 2003-12-06T07:14:06+09:00 Subject: Re: Attempted roadmap of future instance variables.... Hi -- On Sat, 6 Dec 2003, Christoph wrote: > Nathaniel Talbott wrote: > ... > > In this case it is trivial to alias the super-class method if > > I need continued access to the super-classes implementation. > > I don't know of a way that could be done for instance > > variables. More importantly, though, I think instance > > variables are fundamentally a different construct than > > methods. I'm having difficulty precisely delineating the > > differences (internal vs. external?), but I just don't think > > you can compare the potential problems from method overriding > > with those of instance variable shadowing. They certainly > > have commonalities, just as apples and oranges are both > > fruit, but they have quite different cores. > > I am not sure if this philosophical difference > is really so deep - in fact some languages, the > most widely used is probably JavaScript (okay, > maybe that's an argument against my point:-) > don't distinguish between data and methods > at all. But at a non-philosophical level, there's a big difference in Ruby between an instance variable and a method. Nathaniel is right that in discussing how to design and write Ruby classes, one can't assume that if X is true with regard to instance variables, then X.gsub("instance variable", "method") is true about methods :-) Instance variables may assist you in creating a "uniform access" environment for users of your class (actually Ruby really does that for you, since everything is a method call and "attributes" don't exist as separate language constructs), but they themselves do not play the same role as methods. I think that's what he meant. David -- David A. Black dblack@wobblini.net