passing by refference

Tim Peters tim.one at comcast.net
Thu May 15 22:27:08 EDT 2003


[Tim]
> The idea that "call by value" has One True Objective Meaning is
> simply silly, as actually doing the literature search I suggested at
> the start would have shown you.  It's used to mean several distinct
> things, depending on the programming culture using it.

[Joshua Marshall]
> I guess one of the reasons I've continued taking part in this
> discussion is that I think it's useful for terminology to be clear and
> unambiguous; and I'm pushing toward that goal.  But I no longer think
> that's likely (at least for these terms in this group of people).

Well, it's not likely with any group of people <wink>.  "call by value" in
particular has a history dating back to the 1950s, and the older the term in
an explosively growing field, the more meanings it picks up.  That's why I
don't use that specific phrase at all anymore, unless I know my audience
inside-out.  It *should* have been clear that Liskov already had this
problem when explaining CLU, and felt compelled to invent a new phrase to
cut off pointless confusion decades ago.

Do read Henry Baker's paper to see that you're not going to find consensus
on this phrase even in the hardcore Lisp community:

    http://home.pipeline.com/~hbaker1/ObjectIdentity.html

    Lisp is sometimes characterized as "call-by-value", but this is
    incorrect.  Lisp approximates call-by-object-reference semantics
    extremely well, and the single lacuna can be easily repaired.  The
    reason Lisp appears to be call-by-value is that arguments which are
    functional data structures appear to have been passed in toto.
    However, it is the nature of functional data structures that
    whether they are passed by value or by reference is not
    determinable, hence we consider these data structures to have been
    passed by "object reference".

    "Call-by-value" coerces arguments into their "values", which causes
    mutable portions of a structure to be replaced by their current
    values; Lisp does not usually do this. ...

This is the meaning of call-by-value that was most prevalent when I was in
college (early 70's).  Henry is an old fart too, and it's Nature's Design
that old farts die, so that you can hope to do better.  However, I bet
against it <wink>.  In the *purely* functional-language subculture,
call-by-value has become synonymous with strict/applicative-order
evaluation.  There's plenty of evidence for that in Philip Wadler's (a giant
in that field) recent papers:

  http://www.research.avayalabs.com/user/wadler/topics/call-by-need.html

In part this is because (as Baker points out in the quote above) there's no
observable difference between (traditional meanings) call-by-value and
call-by-reference in purely functional languages.  So they took a
comfortable phrase and gave it a meaning more useful to their real needs.

There's no confusion about this when they talk among themselves, though!
Indeed, that's part of what being a subculture means.  It's not usually
intended to be a barrier to keep others out, although it can come across
that way, and misunderstandings when distinct cultures meet are inevitable.

luckily-almost-everyone-on-earth-is-an-old-white-male<wink>-ly y'rs  - tim






More information about the Python-list mailing list