experts disagree on "call-by-reference"

Martijn Faassen m.faassen at vet.uu.nl
Mon Jul 31 05:49:01 EDT 2000


(Greg Weeks) <weeks at golden.dtc.hp.com> wrote:
> Lisp, CLU, Java, and Python implement objects, assign objects, and pass
> objects to functions similarly.  [Although Jave differs regarding its
> "primitive" types.]  So I was curious about how various Lisp, CLU, and Java
> texts dealt with the issue of "references" and "call-by-whatever".  I
> examined my bookshelf.  Some texts used phasing I like; others didn't:

> "Lisp" (by Winston and Horn):
[snip]
> "Common Lisp" (by Steele):
[snip]
> Structure and Interpretation of Computer Programs (by Abelson and Sussman):
[also Lisp]

Note that if you use Lisp to do functional programming, 'reference' and
'value' loses meaning in practice as all objects are treated as immutable.
Just like in Python the immutable objects behave with 'value' semantics.

> CLU Reference Manual (by Liskov and others):
[snip]

> The Java Language Specification (by Gosling, Joy, and Steele):

> The text distinguishes between objects and references.  No mention is made
> of call-by-whatever.

In Java for non-primitive types all variables contain references to objects,
so it's the references that are passed (but no explicit reference taking
happens during the call). This is similar to Python.

> All of the passages mentioned above could just as well apply to Python.
> The experts are in explicit disagreement.

I think it's important to note that 'reference' versus 'value' tends to 
becomes an implementation detail if you do pure functional programming.

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list