[snip]
WHY is var line getting changed by operations on var base_name? Isn't
'base_name = line' supposed to create a copy? '=' in this
case seems to be acting like an alias or something.
Variables point to objects, they do not "hold" or "contain" them.
What you are suggesting is that:
me = Person.new
would create a new Person object, and then duplicate it before assigning
to 'me', or that:
my_really_long_array_name = [ 1, 2, 3 ]
short_name = my_really_long_array_name
would result in two different copies of the array.
That's the opposite of how it works 
···
From: Joe Ruby MUDCRAP-CE
But is oddly enough almost exactly how it works in PHP. And thus one of the
major battles PHP has had between versions has been about the semantices of
reference, and pass/call by reference. I'm GLAD Ruby functions this way, as
it removes a lot of complexity dealing with references.
···
On 11/2/06, Gavin Kistner <gavin.kistner@anark.com> wrote:
From: Joe Ruby MUDCRAP-CE
[snip]
> WHY is var line getting changed by operations on var base_name? Isn't
> 'base_name = line' supposed to create a copy? '=' in this
> case seems to be acting like an alias or something.
Variables point to objects, they do not "hold" or "contain" them.
What you are suggesting is that:
me = Person.new
would create a new Person object, and then duplicate it before assigning
to 'me', or that:
my_really_long_array_name = [ 1, 2, 3 ]
short_name = my_really_long_array_name
would result in two different copies of the array.
That's the opposite of how it works 
--
===Tanner Burson===
tanner.burson@gmail.com
http://tannerburson.com <---Might even work one day...