Re: pass by reference
Andreas Leitgeb wrote:
Peter Duniho <NpOeStPeAdM@nnowslpianmk.com> wrote:
With objects, Java still does a). The parameter is a variable that
references the object. It's not the object itself. And a copy of that
reference the variable holds is passed. If Java did support
pass-by-reference, and you passed an object reference "by reference", then
reassigning the reference would not change the original object, but rather
would change the variable that was pointing to (referencing) that object.
I dare the bold assumption, that all partitioners in this discussion do
know how java works.
We're only discussing human language here, not Java's features.
Somewhat agree. The purpose of human language, in this situation, is to
enable thought about Java's features, and the ability to communicate
understanding of those features from one person to another.
I came to my current position on this subject after viewing many
articles reflecting parameter passing confusion, in this newsgroup and
in comp.lang.java.help. I came to the conclusion that talking about pass
by reference created a not unreasonable expectation of being able to
change the value of a variable, in the sense of changing what object it
references. As far as I can tell, talking about passing a reference by
value, and about variables and expressions being references not objects,
does not lead to any false expectations.
What do you think is the main objective in selecting terminology to
describe Java parameter passing?
Patricia