Quote:
Originally Posted by Oblarg
This is not quite right - java is actually pass-by-value; when passing objects it passes the value of the reference (not the reference itself!). If you reassign a passed parameter in a java subroutine, it will not change anything outside of the subroutine.
(I've heard some object to this by arguing that it is indeed pass-by-reference, but variable assignment in java is best interpreted as name-binding. But this is not how the language specification describes it.)
|
Yeah, I think every Java fan I've ever talked to has insisted that the language is pass by value but the fact that for objects you can only ever have mutable references to them means that all the benefits you'd expect to get with pass by value semantics are effectively destroyed.