unknown wrote:
> Singleton classes are classes.

Yes, I was just trying to make a slight difference, just like we don't 
say "variables" but "instance variables", while both are variables :)

> All of these things are instance variables. The only reason to use a
> longer name is to make it clear in usage where someone might not know
> what you mean. If you've got an instance variable of #<Class:A>, you
> will almost certain describe as "an instance variable of the singleton
> class of the class A", or something like that. There's almost
> certainly no need to create a separate term for it.

I couldn't agree more ! You even almost quoted me (I said "All three 
variables are instance variables").
And I also agree about your "longer name" explanation 100% : I invented 
the term "singleton variable", but I thought it would be as clear as 
your "instance variable of the singleton class of the class A", but 
obviously I was wrong :)

> 
> Mind you, I don't think I've ever seen such an instance variable, so
> it's probably not a big problem :-)

Hehe, ok. Since I'm new to Ruby, I couldn't find out if it had any use 
or not.

> You can also use the attr_* family of methods to create the wrapper
> method(s) for you.
> 
> To do that in your example, you'd do:
> 
>    class A
>      class << self
>        class << self
>          attr_accessor :x
>        end
>      end
>    end
> 

OK !

Many thanks :)

-- 
Posted via http://www.ruby-forum.com/.