If creating a class variable is often dangerous and unpredictable why do we need them?
If solution is just to use class instance variable with the class level accessors:
class Foo
@variable = :something
def self.getvariable
@variable
end
def self.setvariable(value)
@variable = value
end
end
Then why do we need class variables???
Class variables have their use on occasion, but I agree that using the eigenclass is frequently more useful:
The above is safe with inheritance, because it sets a variable in the Foo constant, rather than a class variable.