Official definition of call-by-value (Re: Finding the instance reference...)

greg greg at cosc.canterbury.ac.nz
Fri Nov 21 20:28:41 EST 2008


Steven D'Aprano wrote:

> You've just *assumed* that assignment in Algol 60 doesn't involving
> copying.

I've done no such thing. I've *refrained* from assuming that
the "assignment" in the definition always has to refer to
Algol 60 assignment. You're the one insisting on tying
everything to Algol.

I don't know whether the Algol committee had such a general
meaning in mind when they wrote that document. It's quite
likely they weren't thinking that far ahead. But the fact is
that it *can* be generalized to other languages in an
obvious and useful way, and many language designers after
them have generalized it in exactly that way.

>>(I wait now with bated breath for somebody to point out some Python
>>implementation or feature where assignment doesn't make a copy...)
> 
> Ah crap, I meant *Pascal*.

Not in plain Pascal, but Apple's Object Pascal (and probably
other OO Pascal dialects) have object types that are implicitly
referred to by pointers, like Python objects -- and when you
pass one by value, only the pointer is copied, not the whole
object.

-- 
Greg



More information about the Python-list mailing list