H
Hal Fulton
Here's a slight reality check.
I'm probably largely responsible for the propagation of
the term "class instance variable." I didn't coin it, but
I used it in _The Ruby Way_.
It's not a totally bad term.
But let's remember that a class instance variable... is
really just an instance variable. It's just that the
object it belongs to happens to be a class.
This is confusing if you are used to languages such as
Java where classes aren't objects. In fact, when we say
that an instance variable "belongs to class Foo" in such
a language, we really mean that it belongs to _instances_
of class Foo.
In those languages, there is no distinction. In Ruby, there
is. A "class instance variable" is really just an instance
variable of a class, as opposed to an instance variable of
a non-class object.
In case that helps any.
Hal
I'm probably largely responsible for the propagation of
the term "class instance variable." I didn't coin it, but
I used it in _The Ruby Way_.
It's not a totally bad term.
But let's remember that a class instance variable... is
really just an instance variable. It's just that the
object it belongs to happens to be a class.
This is confusing if you are used to languages such as
Java where classes aren't objects. In fact, when we say
that an instance variable "belongs to class Foo" in such
a language, we really mean that it belongs to _instances_
of class Foo.
In those languages, there is no distinction. In Ruby, there
is. A "class instance variable" is really just an instance
variable of a class, as opposed to an instance variable of
a non-class object.
In case that helps any.
Hal