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

A C pointer is not a reference in the way we are using the word reference in this discussion (as in pass-by-reference, as in an alias for another value without applying any operators).

Sure, the C standard uses the English word "reference", as in "refers to" and "referred to", but letting that confuse you without understanding the meaning of the word in context is what lead to this Java mess in the first place. Don't bring C into it too.



I'm not confused at all, thank you. I'm of the long-standing and well-informed opinion that "pass-by-reference" and "pass-by-value" are worthless terms that need to die, and that this entire conversation is an exercise in useless academic pedantry.


Based on your previous reply, you are indeed confused. Reference is a long-established term, and using it to refer to C pointers is typically considered incorrect.

In addition, pass-by-reference and pass-by-value are very useful terms for anyone interested in accurately speaking about and understanding what will happen when they run the program they write.

There are people who consider accuracy and understanding to be pedantry. More often than not, in my experience, they are a larger source of bugs than those who strive to truly understand how their tools work.


> Reference is a long-established term, and using it to refer to C pointers is typically considered incorrect.

I am not confused, I disagree.

> In addition, pass-by-reference and pass-by-value are very useful terms for anyone interested in accurately speaking about and understanding what will happen when they run the program they write.

The terms would be useful if people agreed on their meaning (they do not) and if languages actually followed one way or the other consistently (they do not). That is the very reason this thread exists.

If you wish to accurately speak about what will happen, then speak about it. Describe what actually happens, instead of spending your time arguing about which round hole the square peg fits in better.

> There are people who consider accuracy and understanding to be pedantry.

In practice, pass-by-value and pass-by-reference provide neither accuracy nor understanding. Stop using them, and these arguments instantly vanish.

> More often than not, in my experience, they are a larger source of bugs than those who strive to truly understand how their tools work.

That I strive to truly understand how my tools work is the very reason I reject these terms as worthless.


> The terms would be useful if people agreed on their meaning (they do not)

Most people agree on the meaning (read the JSL - it says Java is pass-by-value. Read Wikipedia too. Or really any other real reference that isn't some confused people in a forum.)

> If you wish to accurately speak about what will happen, then speak about it

That's what the article does. That's what the JSL does. People in these forums who still don't get it need something more. That's what I'm giving them.


> Most people agree on the meaning (read the JSL - it says Java is pass-by-value.

I assume you mean the JLS, in which case it -- very wisely -- does not use the term "pass-by-value" (or any similar term I've seen) to label its semantics. It simply describes its semantics.

> Read Wikipedia too. Or really any other real reference that isn't some confused people in a forum.)

So is it "most people" or a reference that, if anything, supports my point (JLS), an un-encyclopedia, and unspecified "real references" that aren't from people you enjoy insulting?

> That's what the article does.

That's one thing the article does, yes. Why is it you think you need to point that out?

> People in these forums who still don't get it need something more. That's what I'm giving them.

I agree you are giving people in this forum "something more". I suspect we disagree as to what that "something" is.


> The JLS doesn't use pass-by-value

Well, maybe not the exact letters "p-a-s-s-b-y-v-a-l-u-e" in a row like that, but sometimes you have to read and comprehend.

The JLS does define exactly what happens when parameters are passed...

http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html... http://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#...

And that happens to match the definition of pass-by-value/call-by-value exactly (even Java is listed as an example language for pass-by-value)

http://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_val...

> people you enjoy insulting

I haven't insulted anyone, have I? At least, not intentionally. No name-calling, sticking to the facts... I'm sorry if that somehow offends you. Some of us appreciate correctness and don't attribute the chase of it as ad hominem when it isn't.


> sometimes you have to read and comprehend

If you don't understand how you're being insulting here, I can't help you.

> The JLS does define exactly what happens when parameters are passed...

Yes, it's very nice in that respect.

> And that happens to match the definition of pass-by-value/call-by-value exactly (even Java is listed as an example language for pass-by-value)

It happens to match the definition of "call-by-value" used by whoever wrote that blurb on Wikipedia you seem to love so much. The irony here, of course, is that people who like to use these terms don't even agree on how they're spelled...

None of this makes the terms useful.


If you google "pass-by-value" vs "pass-by-reference" and understand what they mean, in a language-agnostic way, and you understand what Java is doing when you pass parameters, then you too will come to the same conclusion and I have, and the people who wrote the wikipedia article, and everyone else.

If you like, though, feel free to provide your plethora of references and documentation that supports your claim that pass-by-reference is meaningless, and is also what Java does.

> If you don't understand how you're being insulting here, I can't help you.

There's no help needed. Asking someone to read and comprehend is no more insulting than pointing out where they are wrong. If being wrong insults you, then I suggest you refrain from posting misguided opinions in technical forums and standing by your incorrect position even in the face of overwhelming opposition from numerous sources.

If I was being insulting, I'd link you to the proggit thread and say "look, even proggit got it after a short discussion, why are the hacker news folks taking so long to get this simple concept"... but I haven't. Instead I would like to try to correct those who are mistaken. I feel like anyone who comes and reads the incorrect statements in threads like this should be able to then read the corrections so they too don't fall into the same traps you have.


> If you google "pass-by-value" vs "pass-by-reference" and understand what they mean, in a language-agnostic way, and you understand what Java is doing when you pass parameters, then you too will come to the same conclusion and I have, and the people who wrote the wikipedia article, and everyone else.

What conclusion would that be, exactly?

> your claim that pass-by-reference is meaningless

I didn't make that claim.

> and is also what Java does

I didn't make that claim, either. Nor would I ever. Stop putting words in my mouth.


You did though. You claimed the terms were meaningless.

But if you study, you find out they they have very specific meanings.

Calling C pointers "references" is just the tip of the misunderstanding iceberg.

But if you prefer to wander around in ignorance, by all means. Just don't be surprised when your incorrect comments are constantly corrected.


> You did though. You claimed the terms were meaningless.

Just to be sure I didn't comment in my sleep, I went back and looked, and I see the word "meaningless" nowhere in my comments.

> But if you study, you find out they they have very specific meanings.

Some people have defined them in very specific ways. The description in the originally linked article is actually one of the ones I hate the least. That doesn't make it good, and doesn't make the terms useful.

> Calling C pointers "references" is just the tip of the misunderstanding iceberg.

What, precisely, will it take to convince you that I understand your position and simply disagree with it?

> But if you prefer to wander around in ignorance

Please stop being insulting.


> I'm of the long-standing and well-informed opinion that "pass-by-reference" and "pass-by-value" are worthless terms that need to die

> The terms would be useful if people agreed on their meaning (they do not) and if languages actually followed one way or the other consistently (they do not).

Go read some actual literature about programming languages so you can get these ignorant notions out if your head.

The terms pass-by-value and pass-by-reference are well defined and have specific meanings both in the context of specific programming languages and independent of any specific programming language.

Pass by value means the value of the caller expression is logically copied in to the parameters, and direct mutations to the parameter itself are not reflected back to the caller.

Pass by reference means the opposite... The parameter is an alias for the caller's expression, and direct mutations are reflected back to the caller.

C pointers are not called references, except in an informal description of how they relate to what they refer to, by any authority on the topic.

I don't know if you are doing it intentionally or not but I'm done feeding your trolling. If you change your mind and want to learn anything else, my door is always open. But if you want to keep up this charade, whatever it is, go troll someone else. No one is going to read this thread this far down, so I feel no more obligation to correct your unfortunate misguided claims in the spirit of helping someone else who is actually looking for the right answer.


> If you change your mind and want to learn anything else, my door is always open.

I can't imagine what could lead you to think I'd be interested in "learning" from someone who clearly doesn't even understand what my claims/opinions are, but insists they're "ignorant" and "trolling".

What you've accomplished here is not to teach, but to harden my existing biases.


Even the best of us can't help the unhelpable. There has to be at least a basic willingness to listen and change.

But it's no skin of my back. My motivation was less about helping you (it was clear from the start that was probably futile) but to instead leave the right answers where you left wrong ones so others who are willing to learn can find what they need to succeed.

This far down, as I said, that no longer applies.

Good day.


You may be amused to learn that Mr. Noakes' sanctimonious rudeness has got him into a spot of trouble in another thread here.




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

Search: