When using a singleton class (one that includes Singleton, not an
eigenclass), can anyone think of any advantage/disadvantage to using class
variables over instance variables (or visa versa) to access data in the
class?
inheritence will break with either.
with @@var then
class Singleton
@@var = 42
end
class SingletonII < Singleton
@@var = 'forty-two'
end
class Singleton
p @@var #=> 'forty-two'
end
but with @var
class Singleton
@var = 42
end
class SingletonII < Singleton
end
class SingletonII
p @var #=> nil
end
my traits lib solves this - if inheritence of class data is important. it may
not be.
regards.
-a
--
===============================================================================
| ara [dot] t [dot] howard [at] noaa [dot] gov
| all happiness comes from the desire for others to be happy. all misery
| comes from the desire for oneself to be happy.
| -- bodhicaryavatara
===============================================================================