* Sean O'Dell (sean / celsoft.com) wrote:

> "Michael Neumann" <520079130762-0001 / t-online.de> wrote in message
> > Wrong. Only Fixnum (small integers) objects are copied, but not
> > Bignum's (large integers) and String's.
> >
> > Nil, true and false are special, too.
>
> Then why does this statement:

> var1 = "asdasd"
> var2 = var1
> var1 = "qweqwe"
> print("VAR2: #{var2}\n")

> ....print out "asdasd" instead of "qweqwe"?  If var2 points to var1,
> printing out var2 should print the contents of var1, if what you said
> is true.

No, you're thinking along the wrong lines: var2 does not point to var1,
var2 points to the object that is pointed to by var1 at the time of the
assignment.  You then change the object var1 points to (another string),
but var2 still points to the original object.

There's no multiple indirection going on; var2 points directly at the
same object var1 pointed to, without going through var1.

-- 
Thomas 'Freaky' Hurst  -  freaky / aagh.net  -  http://www.aagh.net/
-
We don't need no education, we don't need no thought control.
		-- Pink Floyd