On Mon, Mar 2, 2009 at 4:35 PM, abc [email protected]
I’m the OP. Thank you all for your replies.
I’m not a seasoned Ruby programmer, but I think I was totally right in
the idea of using class variables (@@hash). I cannot see why some
people are surprised. I’d be very happy if somebody could shed some
light on the issue, because maybe I’m missing something…
There is a school of thought that eigenclass  instance variables
are generally preferred over @@class_variables. Folks coming to ruby
from other languages often miss the distinction but you’ll find many
exposés on this , including in the Pickaxe.
I personally like eigenclass variables - they provide all the
capability of class variables, fit elegantly into ruby’s object model
and follow all the rules of instance variables. So i don’t ever bother
with class vars.
It’s important to note this is completely orthogonal to the discussion
about whether it’s appropriate to use any class-level state at all.
That has been adequately addressed in this thread already, but it’s
possible some of the questioning about class variables may actually
have revolved around whether to use eigenclass variables instead.
 a.k.a singleton class, metaclass, etc.