On 4/22/05, Robert Klemme <bob.news / gmx.net> wrote: > > > Class variables are really only useful if you want to access them from > instances and from the class in a similar way (via "@@var_name"). > Otherwise they have more drawbacks than pros so I avoid to use them > whenever I can. (Can't really remember a case where I actually needed > them.) > What about situations like the following ( taken from an attempt at an old rubyquiz ) class Op @@lookup = {} def Op.register(newOp, newOpClass) @@lookup[newOp] = newOpClass end end class AddOp < Op ... end class SubOp < Op ... end class MulOp < Op ... end class DivOp < Op ... end Op.register("+", AddOp) Op.register("-", SubOp) Op.register("*", MulOp) Op.register("/", DivOp) They are not really OO 'clean' but better than globals surely? -- Into RFID? www.rfidnewsupdate.com Simple, fast, news.