Re:Java is Pass-by-Value, Dammit
by mannykannot on Monday March 23, 2015 @12:10PM
(#9251623)
If "we" are talking logically, then "we" should not be using the expression "C++ pointer" in the statement I quoted earlier. Doing so can only lead to confusion in the minds of people struggling to understand Java argument-passing.
Why not? A C++ pointer is a logical construct that exists in the language (as per the language standard) independent of any given implementation.
Same with "Java object reference" and "Java pointer" (synonyms).
If we can't discuss this topic using those well-defined things, what can we use?
Re:Java is Pass-by-Value, Dammit
by mannykannot on Monday March 23, 2015 @05:47PM
(#9253539)
'If we can't discuss this topic using those well-defined things, what can we use?'
I am told you will find all the things you need well-defined in the JLE, and in doing so you will avoid positing a plurality without necessity, as Billy Ockham may or may not have put it.
JLE? Or JLS? If you mean the spec (JLS) then I agree, you can find everything there. Including what I wrote above - that "Java object references" are the same thing as "Java pointers" (both in the JLS). The JLS also describes parameter passing in excruciating detail, and it matches the definition of "pass-by-value" (not "pass-by-reference") exactly.
But if people in this thread could read and understand the JLS, this thread wouldn't exist. Since it does, some of us feel like we should contribute and correct the false statements we see.
Re:Java is Pass-by-Value, Dammit
by mannykannot on Tuesday March 24, 2015 @08:01AM
(#9256033)
You are right, JLS. With regard to whether these comparisons with C++ have led to the desired results, see elsewhere.
Re:Java is Pass-by-Value, Dammit
by mannykannot on Tuesday March 24, 2015 @07:52AM
(#9255994)
The well-definedness of 'C++ pointer' is a non sequitur - it is not a sufficient condition to justify its use in this context. 'Backwardation' is well-defined, yet I doubt it can contribute anything to this discussion.
Logically, a C++ pointer and a Java object reference are nearly identical, as described and defined by their respective language standards. Independent of the implementation chosen.
This is not the same as a C++ reference, which is logically an alias (and may be implemented via pointers, but that's irrelevant).
The confusion in this thread stems from people confusing many things, indeed.