"David A. Black" <dblack / wobblini.net> argued: > On Sat, 7 May 2005, Dave Burt wrote: >> And I think Austin's PDF::Writer example is one case where it's useful >> (that >> is, passing an object by reference into a method so the method can >> replace >> the object). > > It's a bit misleading to call it "passing by reference". In Ruby, all > passing is by value. Many values happen to be references. If you > have a Ref object, and pass it to a method, you are passing it by > value-which-is-a-reference. That doesn't change, even if the object > itself is of a class called Ref or Reference or Pointer, etc. > > I understand that when you then *do* something with that object, you > are manipulating a second object, in a manner that emulates non-Ruby > reference semantics. But still, as far as what's happening when you > call the method with a Ref argument goes, it's still business as usual > for Ruby. I think it's all business as usual for Ruby. It's very similar to passing in an array with 1 element, then replacing that element. If the intention is replacement of the object, I don't see how you distinguish those semantics from "by reference" - the object itself (array or reference) is a reference. Or more correctly, has a reference. Let's call it "pass by Ref" then, where Ref is my name for the container. Cheers, Dave