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

greg greg at cosc.canterbury.ac.nz
Wed Nov 12 12:30:55 CET 2008


Steven D'Aprano wrote:

> Why should anyone take the "Revised Report on the Algorithmic Language 
> Algol 60" as the "official" (only?) definition of call-by-value for all 
> languages everywhere?

Since the term was more or less invented by the people
who designed Algol, I thought it would be a good idea to
find out, from as close to the source as possible, what
*they* intended it to mean.

> Particularly since in practice, people's *understanding* of such terms 
> have more to do with common practice than formal definitions.

If "common practice" includes languages such as Java,
VB and RealBasic, then it accords with the original
definition, as far as I can see.

> I notice that you deleted the last sentence of the definition. I quote:
> 
> "As a consequence, variables called by value are to be considered as 
> nonlocal to the body of the procedure, but local to the fictitious block 
> (cf. section 5.4.3)."

I didn't include that because it's not really relevant --
it's an artifact of the way they describe the effect of a
procedure call by conceptually substituting the call with
the text of the called procedure. You can equally well
think of the parameters as being in the same scope as the
rest of the procedure's locals.

> What are the consequences of such assignment?

It doesn't matter what assignment means in Algol, because
we're talking about Python. We already agree on what assignment
means in Python -- or at least I hope we do!

-- 
Greg




More information about the Python-list mailing list