On Sunday 16 January 2005 09:09 am, David A. Black wrote: | Hi -- | | On Sun, 16 Jan 2005, trans. (T. Onoma) wrote: | > On Sunday 16 January 2005 07:35 am, David A. Black wrote: | > | Hi -- | > | | > | On Sun, 16 Jan 2005, trans. (T. Onoma) wrote: | > | > I'm taking a little poll. | > | > | > | > Let say you're Matz, but without any of the pressures of keeping up | > | > with a previous version of Ruby. What one thing above all others | > | > would you like to see differ about Ruby? | > | | > | I would be happy to see class variables (@@var) disappear. But I | > | don't like the idea of class_attr_reader and things like that. Just | > | use the existing attr_* methods, which Class objects already have just | > | as much access to as other objects. If a Class object needs its own | > | state, let it keep its own state. If it wants other objects to have | > | access to it, let it give them access. | > | > But @@vars cut upwardly across the class hierarchy, which is a bit | > different. Is that right? Please correct me if I'm wrong. | | You're right -- I meant to clarify that I'm talking about 2.0 class | vars, which as I understand it will be truly per-class and will differ | from instance variables of Class objects principally in that they will | be in scope in instance methods. I would rather not have a separate | construct that overlaps so much with instance variables. | | As for the current way class variables work... I'm not convinced that | would be a big loss either. I've seen class variables arise as a | source of confusion over and over again -- and while I don't mind | there being things that have to be explained and that take a bit of | study to grasp, the weight of experience suggests to me that there's | room for refinement in this area. My chosen method of refinement | would be to eliminate them :-) I generally agree with you. I wonder if @@vars could just become somesort of across the board initializer/accessor for instance vars (ie. @vars). class C @@a = 10 def a; @a; end end C.new.a #=> 10 Just exploring out loud here. T.