On Fri, 22 Aug 2003, Yukihiro Matsumoto wrote:

> Class variables are like global variables whose scope is limited to
> the inheritance tree.

It would be nice to have variables like global variables limited to
all instances of a class but not inherited, too.

Why?  The classic Factory model used to justify class variables:
Each car that rolls off the production line has a unique number.  If
we could have class instance variabless  then we could inherit the
numbering code, but reuse the numbers for different models of car.

I have run into this because I'm working on a loans
system, and each item needs a unique id, which I've allocated as an
error correcting code.  This gives me 46000 items. But if I have to
use the same class variable to number my users uniquely as well as
the items they borrow, that uses up space in my limited range.

Maybe in accordance with Ruby philosophy "theres a better way to do
it". If so I'd welcome ideas.  For now, I'm violating Don't Repeat
Yourself. (ouch!)
>
> 							matz.
>
>
        Hugh