Re: pass by reference
Andreas Leitgeb wrote:
Patricia Shanahan <pats@acm.org> wrote:
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,
This was, because "pass by reference" alone is indeed misleading.
I always wrote "passing *objects* by reference".
Adding the word "objects" makes no sense at all, because there may not
be any object. Null references can be perfectly valid actual arguments.
What do you think is the main objective in selecting terminology to
describe Java parameter passing?
The objective is, to explain some effect using a language that I think
the target knows. Natural language appears to me superior to a language
of technical terms with exact definitions from which only experienced
programmers can grasp all the subtleties.
Java learners can be divided, for this purpose, into two sets, those
that already know what "pass by reference" means and those that don't.
For those that don't, "pass by reference" and "pass reference by value"
are both new language, and they might as well be told how Java really
behaves.
The issue is more critical for people for whom "pass by reference" is
familiar language. They will think they know what it means, and have to
find out somehow that it means something entirely different, when
talking about Java, that it does when talking about other languages.
Patricia