From: "T. Onoma" Date: 2003-12-10T14:14:26+09:00 Subject: Re: Attempted roadmap of future instance variables.... > on 03/12/06, "T. Onoma" writes: > |Wouldn't it be better just to have instance vars (@foo) local to the > | class. Then subclasses and superclasses (and reportedly singletons too) > | would have to go through accessor methods? Just seems like a simpler and > | more elegant solution. Or is there a problem with this that I'm not > | seeing (besides "back breaking" compatability)? > > That would be interesting alternative idea. I think it's matter of > how much compatibility we would preserve. A word of update on this idea. I have been writing my lastest code as if this were already fact, in order to get a realistic feel for what it would be like. It works fine except for one signifficant age old problem: the ambiguity between methods and local variables. Because instance variables would be local to their class, one would then uses writer methods from mixins and subclasses and so forth. Unfortunately you always have to use self as a reciever on these to prevent them from being local variables. The age old ambigutiy rears its head again. Quick ex- class K attr_writer :h end class Q < K def hi(x) self.h = "Hello, #{x}" # must use self end end Honestly, I would prefer using % for local variables and kill this ambiguity once and for all! T.