thanks Guy for your explanations!

>  ruby is trying to say that the variable @@v will be defined in Object,
>  because there is no other class where it can define it.
>

I didn't (and still can't ;-) translate the message  "class variable
access from toplevel singleton method" to your explanation of it.

Anyway, I started to play with class instance variables, and got this
code working, if anyone's interested:

class A
  def initialize(i)
    @value = i
  end

  def test_in_class
    @value>@@v
  end
end

a = A.new(3)

class << a
  @cvalue = 5
  class << self
    attr_reader :cvalue
  end
  def test
    @value>(class << self; self; end).cvalue
  end
end

a.test


Cheers

Raph

>
> Guy Decoux
>
>
>
>
>
>