From: Julian Tarkhanov Date: 2007-09-30T04:29:06+09:00 Subject: Re: a = Dog.new # a is not a pointer and not a reference? On 29-sep-2007, at 19:16, SpringFlowers AutumnMoon wrote: > In that case, we can say that a is a pointer and not a reference. This has been discussed at greatest length imaginable. Personally I use the somwehat unacademic "a direct reference to an object in the heap" for variables in Ruby. Whereby the reference is just that - a handle, not a value in itself (some address of something or other). The only moment when it is handy to knowis when doing assignment. boo = Dog.new # this makes a new Dog in the heap and saves it's "handle" in boo boo = nil # this wil NOT replace the new Dog in the heap with a nil, but will link boo to the single instance of NilClass - the dog will stay in the heap and will eventually # be GCed From there comes the Object#replace method. For the rest you can more-less safely assume that everything happens by reference. -- Julian 'Julik' Tarkhanov please send all personal mail to me at julik.nl