"Fritz Heinrichmeyer" <fritz.heinrichmeyer / fernuni-hagen.de> wrote in message news:86fzyic0nh.fsf / jfh00.fernuni-hagen.de... > > Here is part of a code snippet posted earlier. > > require 'postgres' > module Apache > class RubyRun > @@pg_conn_handler = nil > > def RubyRun.pg_conn > if !@@pg_conn_handler > > ..... > > > I believe that > > @@pg_conn_handler = nil > > is not set in the context of a method so there will be set an object > variable from .. which class? There was a big overhaul in behavior of class variables (in the 1.6 and 1.7 series) a couple of month ago. Generally speaking, the new class variable scoping rules is modeled around class constant rules. --- $mess = "There is no such as a ``singleton class'' class variable, instead a class/module variable of the surrounding genuine (non singleton) class or module is created or modified. " class Outer class Inner end class << Inner Const = "Makes sense too!!!" @@class_var = $mess def const_mess puts Const end end def var_mess puts @@class_var end end # make use of const of Singleton class class Sub < Outer::Inner; end class Outer # make of use of Outer's class variable def Sub.var_mess puts @@class_var end end Outer.new.var_mess Sub.var_mess Sub.const_mess # resulting in --- There is no such as a ``singleton class'' class variable, instead a class/module variable of the surrounding genuine (non singleton) class or module is created or modified. There is no such as a ``singleton class'' class variable, instead a class/module variable of the surrounding genuine (non singleton) class or module is created or modified. Makes sense too!!! --- There was thread about this issue in last month German mailing list - see for example http://lists.bttr.org/pipermail/ruby-de/2002-June/000044.html where I to explain the exact same question ... /Christoph