What other languages use the same data model as Python?

Gregory Ewing greg.ewing at canterbury.ac.nz
Wed May 4 23:48:51 EDT 2011


Hans Georg Schaathun wrote:
> Is transmission by name the same as call by object?

No, it's not. With call-by-name, the caller passes a
small function (known as a "thunk") that calculates the
address of the parameter. Every time the callee needs to
refer to the parameter, it evaluates this function.

This allows some neat tricks, but it's massive overkill
for most uses. In later languages, the functionality of
call-by-name has been replaced by the ability to explicitly
pass functions as parameters.

> Anyway, I have never seen anyone counting more than
> three ways of doing this ...

There are other possibilities, such as value-result,
where a local copy is made and its final value is
copied back before returning. I think Fortran is
defined in such a way that this is an acceptable way
of implementing parameter passing. It's also the
only way of getting anything akin to by-reference
over an RPC connection.

But for most situations, by-value and by-reference
cover anything you might want to do. And if you
have a dynamic data model like Python, you don't
even need by-reference.

-- 
Greg



More information about the Python-list mailing list