> > My understanding of things so far was that :sym and 3 are immediate > > values, > > and after writing > > a, b = :sym, 3 > > a is a reference to :sym and b is a reference to 3. > > Have I been wrong all the time? > > I wonder that too. What about: > a, b = :sym, :sym > I guess a and b hold separate references to the same object, much as if I > did > a, b = 4, 4 > Basically I suppose I'm confused about assignment by value or reference. I > though Ruby was pass by reference, with references passed by value, no > matter what? The 'pass by reference/value' terminology isn't used much in Ruby (or in Smalltalk, Java, Python...), from the programmer's point of view there's only one type of assignment and parameter passing. But technically, a variable can hold either a reference to an object or an immediate value. All normal objects are assigned by reference, so in a=Object.new or a="some string" 'a' holds a reference. The reference is a pointer to the object's location in memory. Fixnums and a few other special types (symbols, true/false/nil, floats?) are assigned as immediate values: Instead of storing a pointer (or reference) to the value object, the variable stores the value directly. So in a=4 'a' does not hold a reference, technically speaking, but rather the immediate value 4. This is an implementation issue, and is done for efficiency. But the difference is largely transparent to the programmer, so I guess it's mostly of interest to those who want to know how the language works behind the scenes. jf