From: Brian Candler Date: 2010-11-11T23:59:09+09:00 Subject: Re: what's an object? Ammar Ali wrote in post #960710: >> No variable ever *is* an object in Ruby.  Variables *reference* objects! > > Now that's a different, or at least clearer, statement. And it fits > with what I know. Yes. It's important when you compare "pass by value" or "pass by reference" in other languages. In ruby, everything is "pass by value", and each value is a reference to an object - even integers. IMO this is a *huge* logical simplification over languages like perl (scalar? array? array ref? list? hash? hash ref? filehandle? typeglob? subroutine? Deal with them all differently) In ruby, a local variable is not an object, and as such you can never obtain a "reference" to it. def foo(x) x << " world" end a = "hello" foo(a) a is passed by value, so the method call foo(a) can never affect the value of a - it must remain pointing to the same object after the call. However, if the object is mutable, it can cause it to change state (using the << method in the example above) -- Posted via http://www.ruby-forum.com/.