Value type or reference type

wow! seems i completely misunderstood the concepts!! maybe i should just stop looking at all languages with java-colored classes :frowning:

gavri

···

-----Original Message-----
From: Austin Ziegler [mailto:Austin.Ziegler@evault.com]
Subject: Re: Value type or reference type

Fixnum is value type, but whatever you pass into addOne() is
passed by value, which means that a copy of the value is made.

This is not so: everything [except immediate values] in Ruby is
passed by reference, not by value. Immediate values are immutable in
any case, so it is as if they were passed by reference in any case.
There is no meaningful distinction between a “reference type” and a
“value type” from the Ruby programmer’s perspective.

The trick is that variables aren’t bound to objects the way that
they are in languages like C++ and Java; they merely refer to a
given object reference at a given time.