Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This topic (I do not know why) raises some serious emotion-based responses on coders. The other topic I know will cause almost a religious flame-war is the philosophical meaning of "null" in the SQL arena.

I've tried to add some insight why the OP hears (so many) >folks (incorrectly) state "primitives are passed by value, objects are passed by reference"

What I believe was my constructive addition to the topic, seems to deserve only downvotes. I'll make a reminder to not participate again in this kind of topics.



> This topic (I do not know why) raises some serious emotion-based responses on coders.

I saw the title on HN, and was like "uhhh, no shit, why is this here?". Then surprisingly, it all of a sudden it has 80 points and almost 50 comments debating the details. I don't think there's any actually real debate on how Java actually works, this must be a purely linguistic. Or as you say, "emotional".

SQL NULLs, on the other hand, is a real philosophical war. One which the wrong size is clearly wrong and need to be crushed into ashes underneath our boots. We are not debating jargon, we are defining databases which could certainly outlive our sons and daughters!!!! .. Ok, sorry. But I just don't think it's good comparison with students who just don't really get Java. Database design is largely a matter of opinion, Java method calls are not.


It is definitely emotional for me: I remember reading yet another of these "java is not pass by reference" posts, and the title stuck for some reason. So next time I wrote a Java function (long afterwards), I modified a list received as an argument inside a function, and could not understand why my original list was modified.

I honestly feel that these posts titles are just trying to pull my leg. "Java passes everything by value!" "Really? And which value is being passed?" "The reference, of course!".


So instead of programming based on vague recollections of blog titles, you should strive to understand the language you are writing in, so that you don't make those mistakes.

Reading the content of the articles, doing some research, and actually understanding what is happening in the language are all good steps to consider taking.


I'm on the same page as you, that's why I'm getting the downvotes.


Could be worse: could be one of the debates about Python, where people who don't work in Python insist that it must follow one or the other paradigm (when trying to shoehorn either a consistent pass-by-value or a consistent pass-by-reference interpretation on Python's behavior will lead you to write code with bugs).


How is Python not pass-pointer-by-value?


The main issue, as I noted, is people who come from other languages and have preconceived notions about what "pass by value" and "pass by reference" mean and preconceived expectations about language behavior as a result.

In Python, worrying about whether it's "pass-by-X" paradigm is practically worthless; instead, what you want to know in Python is which types are mutable.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: