10 August 2017

Coolpointer.016 : pass by value

    Java is Pass-by-Value, Dammit! by Scott Stanchfieldis is an article that busts a myth that
"primitives are passed by value, objects are passed by reference".
"Java is strictly pass-by-value, exactly as in C. Read the Java Language Specification (JLS). It's spelled out, and it's correct. In http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4.1:
When the method or constructor is invoked (�15.12), the values of the actual argument expressions initialize newly created parameter variables, each of the declared Type, before execution of the body of the method or constructor. The Identifier that appears in the DeclaratorId may be used as a simple name in the body of the method or constructor to refer to the formal parameter."
The truth is that  Primitives and Object references are passed by value. Check  his article to read about why is like that. It is an interesting read. 

On side note. I believe that we as IT professionals we should really define clean glossary and give them a  As it turns out there is a lot of mess due "semantic" around that.

Equality in JavaScript by Scott Stanchfieldis

No comments:

Post a Comment