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

Aaron Brady castironpi at gmail.com
Thu Nov 20 07:51:04 EST 2008


On Nov 19, 7:22 pm, greg <g... at cosc.canterbury.ac.nz> wrote:
> Antoon Pardon wrote:
> > You are changing your argument. In a follow up you
> > made the point that call by value should be as it
> > was intended by the writers of the algol 60 report.
>
> No, I was countering the argument that "call by value"
> is short for "call by copying the value". I was pointing
> out that the inventors of the term didn't use any such
> words.
>
> Arguing that their words were intended to imply copying,
> as part of the essence of the idea, is making an even
> bigger assumption about their intentions, IMO.
>
> Rather it seems to me that the essence of the idea they
> had in mind is that call-by-value is equivalent to
> assignment.
>
> Furthermore, I don't seem to be alone in coming to that
> conclusion -- the designers of other dynamic languages
> appear to be using the same logic when they describe
> their parameter passing as call-by-value.
>
> Here's an example from "The SNOBOL Programming Language",
> 2nd Edition, by R. E. Griswold, J. F. Poage and I. P.
> Polonsky. On p. 15:
>
>    Arguments are passed by value and may be arbitrarily
>    complex expressions.
>
> and later on p. 95:
>
>    When a call to a programmer-defined function is made, the
>    arguments to the call are evaluated first. Before execution
>    of the procedure begins ... new values are assigned to these
>    variables as follows: ... (2) the formal arguments are
>    assigned their values.

Tell me, what happens during a call to the following C++ function?

void f( std::vector< int > x );

Is it the same as what happens during a call to the following Python
function?

def f( x ): ...

If not, which one is call-by-value?



More information about the Python-list mailing list