From: Florian Frank Date: 2006-07-31T08:12:51+09:00 Subject: Re: what is the scope of this object Sch端le Daniel wrote: > class Q > @x=1 > end > to whom does @x belong now? Q.instance_variable_get :@x # => 1 > Does it make sense? (Usually one wants to create with @@ class > variables at this scope) @@variables are shared across the whole class hierarchy. Often that is not what is wanted. IMHO they are rather useless. Your @x from above is a class instance variable, a variable of the class object Q. It's a good idea to use accessor methods to set/get its value. class Q class << self attr_accessor :x end self.x = 0 end Q.x # => 0 Q.x = 1 Q.x # => 1 -- Florian Frank