4 ms·
I fully understand the difference, and I know that you're technically correct. What I'm saying is that people tend to abbreviate "pass-a-reference-by-value" to
by lucio 12y ago
I fully understand the difference, and I know that you're technically correct.
What I'm saying is that people tend to abbreviate "pass-a-reference-by-value" to "pass-by-reference" because the differences between passing a value (value snapshot) and passing a reference-value (passing the address-of) are way more important* than if the language syntax allows you to pass an "implicit" variable reference or not. (the swap example)
*"more important" for code-reading, code-analysis, code-safety analysis, and also even more important in a concurrent environment because of side-effects and data-races.
Maybe the feature should be called "pass an implicit reference", which describes better what Java does, instead of saying "everything is pass-by-value" which is correct but, as the evidence shows (the mere existence of the article), it is very confusing for "folks".
>I'm really tired of hearing folks (incorrectly) state "primitives are passed by value, objects are passed by reference".
- deleted 12y ago[deleted]