From: Marcin 'Qrczak' Kowalczyk Date: 2003-05-20T16:35:41+09:00 Subject: Re: Ruby reference recommendations Dnia wto 20. maja 2003 08:10, Dave napisa�: > When exactly does Ruby pass by reference and when does it copy the object? Conceptually it always passes by reference, never makes a copy. > If you return an object from a function, does it copy that object, or does > it return a reference? Again, always a reference. > If it returns a reference like I think it does, does that provide the > calling function with access to write to the returned object? Potentially yes. Some objects don't provide any method which changes their state, so in these cases there is no access to give or refuse. I'm surprised that so many people are confused by that. Most languages, and almost all modern languages, work like this, and the model is really simple - there is one way to pass arguments, one way to return results, and no implicit copying. These languages don't include C, C++ and Pascal though. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/