Well, if @_var make reference to what was initially,
wrongly, called “private instance variable” then renamed in
“class local variable” then it’s private to the instance
Just for the record the starting point (started by nobody
else but yourself:-) of a long, probably definite thread on
the subject was [ruby-talk:49849]. The original post to get
the ball rolling was Christian’s post [ruby-talk:49161].
My least favorite of all of the proposed changes is definitely the @var/@_var thing. It means that, for the first time, the concept of
an instance variable will not be completely unified. At the very
least, I don’t think something should be called an “instance variable”
if it isn’t private to the instance. (And then there’s that
underscore…
Well, if @_var make reference to what was initially, wrongly, called
“private instance variable” then renamed in “class local variable” then
it’s private to the instance
I’m not sure I follow entirely – which one was wrongly called that?
(I’m just going by Matz’s slide, where “instance variable” covers the
case where it’s visible to subclasses, which are different instances.)
Oh right. I keep forgetting those because I wish they would go away (Sorry Matz, if you're reading; I just personally don't like magic
behavior depending on the name of a variable, in any language.)
Implement it and just wait for error from standards libraries :-))
Well, if @_var make reference to what was initially,
wrongly, called
“private instance variable” then renamed in “class local variable”
then it’s private to the instance
I’m not sure I follow entirely – which one was wrongly called that?
In the original discussion what we call “class local” instance variables
today (I actually think I coined that term - in connection - ups -
analogy - to block local variables:-) was originally called “private”
instance variables.
OK… but then they’re “class local variables”, right, not “class local
instance variables”? (since they’re visible inside method definitions).
(I think I missed or have forgotten a thread somewhere…)
David
···
On Mon, 1 Dec 2003, Christoph wrote:
David A. Black wrote:
…
Well, if @_var make reference to what was initially,
wrongly, called
“private instance variable” then renamed in “class local variable”
then it’s private to the instance
I’m not sure I follow entirely – which one was wrongly called that?
In the original discussion what we call “class local” instance variables
In the original discussion what we call “class local” instance
variables
OK… but then they’re “class local variables”, right, not
“class local instance variables”? (since they’re visible
inside method definitions).
Yes, I just wanted to be “über” correct and added
the collectively swallowed “instance” part - since
they are “kind_of” an instance variable.
Although… I think that if a variable’s scope is a superset of
instance scope (which would include class local variables and global
variables), then it really isn’t an instance variable (although it may
well serve to do the same things as one in many situations).
Not to quibble – just reasoning it out in anticipation of change
In the original discussion what we call “class local” instance
variables
OK… but then they’re “class local variables”, right, not “class
local instance variables”? (since they’re visible inside method
definitions).
Yes, I just wanted to be “über” correct and added the collectively
swallowed “instance” part - since they are “kind_of” an instance
variable.
Although… I think that if a variable’s scope is a superset
Nope it’s a subset of today’s instance variables …
of instance scope (which would include class local variables
and global variables), then it really isn’t an instance
variable (although it may well serve to do the same things as
one in many situations).
Not to quibble – just reasoning it out in anticipation of change
I thought that a class local variable was going to be visible to the
Class object and its instance:
well, what difference do you make between @_v and @@v ?
From Matz’s description I’m not sure I see any difference; they’re
both described as “local to the class/module”.
I seem to be failing to understand the new rules. The only thing I’m
sure of is that if a variable is directly visible to two different
'self’s, then it is not an instance variable. Please explain the
rest
Don’t even bother; it has dawned on me that I have been forgetting
that not all variables are created at class scope. Well, I was right
about one thing: I’m being stupid
David
···
On Tue, 2 Dec 2003, David A. Black wrote:
Hi –
On Tue, 2 Dec 2003, ts wrote:
From Matz’s description I’m not sure I see any difference; they’re
both described as “local to the class/module”.
Well, except that one is described in the slide 13 and the other in the
slide 20. Perhaps it’s important
OK, I’m officially being stupid. Can someone please explain?
In message “Re: Class-level readers and writers” on 03/12/02, “David A. Black” dblack@wobblini.net writes:
From Matz’s description I’m not sure I see any difference; they’re
both described as “local to the class/module”.
Well, except that one is described in the slide 13 and the other in the
slide 20. Perhaps it’s important
OK, I’m officially being stupid. Can someone please explain?
@_v is an instance variable whose scope is limited to the
class/module. @@v is a class variable, which is kinda like global
variable whose scope is limited to the class/module.