From: Gary Wright Date: 2007-08-08T05:56:08+09:00 Subject: Re: Question - Passing parameters by reference On Aug 6, 2007, at 8:16 PM, Logan Capaldo wrote: > this seemed to illustrate it better in my head. Seeing it typed > out, it > doesn't look so insightful. I guess what I'm trying to say is. > don't think > of literals as ways of referring to objects, think of them as > method calls > that return objects. Or something like that. > It is confusing to me to even think about methods returning objects unless you are using that as a very specific shorthand for saying that methods return *references* to objects. That is the unifying idea that helped me understand how Ruby manipulates data--it is all references and not the objects themselves. The objects themselves are almost completely hidden from the programmer (excluding C extensions) in Ruby. Everything is a reference to an object. At least that is the way I have come to understand things but it means that you have to ditch the idea that Fixnum's and Symbols (and true, false, nil) are somehow special cases. In my mind they are not. The literals :blue, 42, true, false, nil are all references to particular objects and assignment is the process of binding a reference to a variable. Of course I'm not talking about the underlying *implementation* that Ruby uses to make this all efficient. I'm talking about the abstract semantics of Ruby's object model. Gary Wright