experts disagree on "call-by-reference"

Greg Weeks weeks at golden.dtc.hp.com
Sun Jul 30 18:20:48 EDT 2000


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):

The text makes no distinction between objects and references to objects,
and it states that Lisp is call-by-value.

"Common Lisp" (by Steele):

The text makes no distinction between objects and references to objects.
The text implies that objects are addresses: "(eq x y) is true iff x and y
are the same identical object.  (Implementationally, x and y are usually eq
iff they address the same identical memory location.)"  No mention is made
of call-by-whatever.

Structure and Interpretation of Computer Programs (by Abelson and Sussman):

The text implies that objects are addresses: "In this representation, which
is called box-and-pointer notation, each object is shown as a pointer to a
box".  The text then partially reverses itself with: "The box for a pair is
actually a double box, the left part containing (a pointer to) the CAR of
the pair and the right part containing the CDR."  For consistency, "(a
pointer to)" should have been omitted.  The text states that Lisp is
call-by-value.

CLU Reference Manual (by Liskov and others):

The text doesn't say quite what an object is, but it seems to say that an
object is not an address.  It also states that CLU argument passing is not
call-by-value or call-by-reference. but is instead "call-by-sharing".

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

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

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

Regards,
Greg



More information about the Python-list mailing list