What other languages use the same data model as Python?

harrismh777 harrismh777 at charter.net
Wed May 4 21:11:02 EDT 2011


Grant Edwards wrote:
> The "pass by value" and "pass by reference" parameter passing
> mechanisms are pretty well defined, and C uses "pass by value".

Yeah, that's kind-a funny, cause I'm one of the guys (old farts) that 
helped define them....


The problem you're having here is that you're thinking of parameter 
passing 'mechanisms' and not focusing on the definition of the terms.

A reference is a pointer (an address).

A value is memory (not an address).


These definitions go all the way back before the 8080, or the 6502, 8 
bit processors. Pass by reference has 'always' meant pass by using a 
memory address (indirect addressing);  a reference has always been a 
memory pointer.


If I call a function in C, and pass-by-value, the data's 'value' is 
placed on the stack in a stack-frame, as a 'value' parm... its a copy of 
the actual data in memory.

If I call a function in C, and pass-by-reference, the data's 'address' 
is placed on the stack in a stack-frame, as a 'reference' parm... no 
data is copied and the function must de-reference the pointer to get to 
the data....   this is by definition.



There may be some language somewhere that does pass-by-reference which 
is not implemented under the hood as pointers, but I can't think of 
any...   'cause like I've been saying, way down under the hood, we only 
have direct and indirect memory addressing in today's processors. EOS.

If you pass a parm, you can either pass a copy (value) or pass a 
reference to its location (not a copy, a reference).


kind regards,
m harris







More information about the Python-list mailing list