From: Robert Klemme Date: 2009-09-11T19:48:50+09:00 Subject: Re: How Are Variables Kept Independent of Each Other Yet Pass Values? 2009/9/10 Mason Kelsey : > This also answers my question of why Ruby was designed this way.  Because it > is an OO language. There are other OO languages around that implement different concepts of "value" and "reference". This does not exactly have something to do with Ruby being OO. In fact, you could have a procedural language which behaves the same with regard to objects and references - you just don't have methods. If you look at C++ > Still, for the old timers coming from a COBOL environment, this is a bit of > an annoyance.  And any instructor needs to be sure that the students > understand the significance of variables being objects. Variables are NOT objects. Variables hold references to objects. You can copy a reference as much as you like, this does nothing to the object where it points to. If there are no longer any live references to an object, the object is no longer reachable (i.e. cannot be used). Some time after this state is reached, Ruby's garbage collector will come along and free the memory. But that is just housekeeping - the object was "lost" for the program before that point in time. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/