From: "Chr. Rippel" Date: 2002-02-12T09:31:16+09:00 Subject: Re: Class variable madness "David Alan Black" wrote .... > > So the semantics depends on the order of definition. Because of this > > behavior, I treat class vars sort of like globals and use them only in > > prototype code, quick and dirty code, etc. For code that I can think > > about more (and expend more keystrokes), I use class instance variables, > > and write a bunch of accessors. > > This came up in some discussion about class variables last year. Matz > said in [ruby-talk:19974]: > > I know this happens. I consider this as an error that Ruby does not > detect yet. Ruby already issues a warning about this. That said, if you throw in class variable behavior under mixins and extensions, mix in the issue of regular class variables versus class variables on the meta class level and for good measures sub_class (before and after) everything, one starts to wander if class variables were really worse the trouble they create. Class instance variables together with accessor methods seem to offer everything class variables offer without the interpretation headaches. /Christoph