What other languages use the same data model as Python?

Grant Edwards invalid at invalid.invalid
Wed May 4 17:57:29 EDT 2011


On 2011-05-04, harrismh777 <harrismh777 at charter.net> wrote:
> Grant Edwards wrote:
>>> We do not consider passing a pointer as*by value*  because its an
>>> >  address; by definition, that is pass-by-reference.
>> No, it isn't.  It's pass by value.  The fact that you are passing a
>> value that is a pointer to another value is not relevent.
>>
>
> @ Edwards, &Schaathun
>
> You are most definitely mistaken.

The "pass by value" and "pass by reference" parameter passing
mechanisms are pretty well defined, and C uses "pass by value".

> I understand that semantically some people insist that when C
> receives parms as pointers that pass-by-reference is only being
> simulated.

And they are right.

> If I want to pass values to my C functions, I can.  If I want to pass 
> references to my C functions, I can.

We're not talking about what _you_ do. We're talking about what the C
_compiler_ does.  The C compiler passes by value -- always.

> If I want to implement a C language that does not use pointers directly 
> (hides them) I can implement pass by reference completely (on the 
> surface).

That wouldn't be C.

> In fact, I can implement the C compiler so that pass by value is not
> allowed! [ it wouldn't look much like C, but its do-able ]

If you don't pass by value, it's not a C compiler.

> Everyone forgets that their high-level language is not 'really'
> what's working...  gcc does not produce machine code... it produces
> assembler instructions that are passed to a translator... you can
> interrupt the process and have it produce the assembly instructions
> so you can see them if you want to...  the point being, after all is
> said and done, all you can do with today's von Neumann processors is
> pass data directly (value) or indirectly (reference).

I have no idea what your point is.

At the machine level, there _is_ nothing but values.  You can use a
value as an integer, or as a pointer.  It's still just a value.  But
we're talking about parameter passing mechanisms defined by high-level
language specifications -- particularly C.

-- 
Grant Edwards               grant.b.edwards        Yow! It was a JOKE!!
                                  at               Get it??  I was receiving
                              gmail.com            messages from DAVID
                                                   LETTERMAN!!  !



More information about the Python-list mailing list