X
Xavier Noria
That's actually what I meant: When passing the parameter the diagram
is correct. I do not see any reason why you claim the diagram
incorrect - for what the param passing semantics concerns - only
because Ruby gives you the freedom to reassign the param inside the
body of the method.
You think the parameter is an alias, and the local variable masks it
right? As if usage was pass-by-value but you couldn't tell because of
that formality. Isn't that convoluted? The spec says local variables
are created, why do you think a second local variable is later created?
I wanted to express that this manipulation should not be used to prove
the correctness or incorectness of a given param passing model.
Clearer?
I am not familiar with MRI but I'd swear this is what implements the
argument value copying of pass-by-value semantics (that's from
vm_insnhelper.c in 1.9.2):
/* copy arguments */
for (i=0; i < (sp - rsp); i++) {
p_rsp = rsp;
}
There, rsp has type VALUE*. If I understand the code correctly, that
in turn comes from copying the VALUEs in the argv argument of
vm_call0(). They are all plain assignments, we are just copying
pointers (or immediate values).