On Fri, Nov 12, 2010 at 5:15 PM, Robert Dober <robert.dober / gmail.com> wrote: > On Fri, Nov 12, 2010 at 4:18 PM, Xavier Noria <fxn / hashref.com> wrote: >> On Fri, Nov 12, 2010 at 3:56 PM, Robert Dober <robert.dober / gmail.com> wrote: >> > All you saying is completely clear, but does still not answer my question. > > Did you disagree with the diagram because it expresses an alias (I > fail to see that); or because of the fact that the arrow pointing to > the same object is "volatile"? > > That was my question, sorry if I was not clear 'nuff or was too > critisizing in the way of asking, I guess I was. Let me try to draw a new diagram with words. When we perform x = Object.new x does not hold an object. The variable holds a reference (my interpretation of the verb "refers" in the spec). Say that reference is in the case of MRI the VALUE 2158949260 (that is, a pointer). So the diagram is inexact and I think I will revise it. The variable x stores 2158949260, and it is the VM that gives you syntactic sugar everywhere so that x.nil? follows the pointer for you to reach the object to be able to send :nil? to it. The boxes in the diagram point to a value, 1, while it would be more clear to put the 2158949260 in the box. And perhaps a second box after it with the 1. (And an integer is also exceptional in MRI, would use a different value). That'd make the pass-by-value workflow more clear. When you invoke def m(y) end passing x as argument, the VM constructs a new local variable y (local to m), and initializes the variable with the value of x, which is 2158949260. In this schema, x and y are unrelated variables, bound to unrelated storage areas that happen to store the same integer value (a C pointer). Via the pointer they reach the same object, and that's why you can change the state of a mutable object. The same pointer reaches the same object. If Ruby was pass-by-reference x and y would point to the same box containing 2158949260. And assignment would change that integer for both variables. Do you agree with the picture?