D
dblack
Hi --
I've been using Usenet since 1990 and never trolled. I'm not going to
start now.
I'm talking about Ruby, not C. In Ruby, you can modify a receiver
without changing its instance variables -- in fact, you can modify a
receiver that doesn't *have* any instance variables.
irb(main):001:0> s = ""
=> ""
irb(main):002:0> s.replace("abc")
=> "abc"
irb(main):003:0> s.instance_variables
=> []
The term "instance variable" has a specific and unambiguous meaning in
Ruby.
David
--
David A. Black ([email protected])
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)
"Ruby for Rails" chapters now available
from Manning Early Access Program! http://www.manning.com/books/black
} >and how can one modify a receiver without modifying its instance variables,
}
} str = "hello"
} str.replace("goodbye")
}
} I've changed str without any instance variables being involved. Same
} with:
}
} array = [1,2,3]
} array.pop
}
} and so forth.
It's a technicality. Consider strings. Their internals are under the hood,
so you claim that no instance variables are involved. This is not
technically accurate. Object state happens to be held in C variables rather
than Ruby variables (which are, of course, backed by C variables), but they
are most certainly instance variables. Are you trolling or do you actually
believe you are right?
I've been using Usenet since 1990 and never trolled. I'm not going to
start now.
I'm talking about Ruby, not C. In Ruby, you can modify a receiver
without changing its instance variables -- in fact, you can modify a
receiver that doesn't *have* any instance variables.
irb(main):001:0> s = ""
=> ""
irb(main):002:0> s.replace("abc")
=> "abc"
irb(main):003:0> s.instance_variables
=> []
The term "instance variable" has a specific and unambiguous meaning in
Ruby.
David
--
David A. Black ([email protected])
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)
"Ruby for Rails" chapters now available
from Manning Early Access Program! http://www.manning.com/books/black