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

Correctness is indeed important, which is why I wrote 'for the purposes of this discussion.' The topic of the original article is what Java does, and additional capabilities in C++ are not pertinent. Dlubarov posited that the author has sown confusion by using the term 'reference' in a C++-specific way, but I believe that confusion arises from a misreading of the article.


The phrases "pass-by-reference" and "object reference" need to be (and are) well-defined for the purposes of this discussion and for Java as it stands alone separate from C++.

But also, for the purposes of this discussion, it is very useful and illustrative to equate pass-by-reference to C++ references, and object references to C++ pointers, because the languages are similar and the concepts match up very well, and because these things are more explicit in C++.

Sure, one could have defined everything without comparing to C++ (in fact that is what the JLS does) but, for the purposes of this discussion, many of us assumed that wasn't good enough for many posters here, because if it was, this discussion wouldn't exist.


You are, of course, entitled to your opinion that the best way to clear this up is by making comparisons to C++, but the problem is that in defending your comparisons, you have brought in various issues, such as that C++ references cannot be rebound and the differences between the meaning of 'pointer' in the two contexts, that can be dispensed with if you do not take this approach. Personally, I think that those people who are both confused and looking at this from a C++ perspective would be better advised to stop making comparisons and look at Java for what it is.


Clearly reading the JLS wasn't good enough for most people. So what do you turn to when people take a well-established programming term like "pass-by-reference" and apply it where it doesn't belong?

Seems to me like a good place is a modern, widely-used language which is similar to Java but also has both pass-by-value and pass-by-reference so one can illustrate what those terms actually mean and how they differ.

Seems like C++ is as good a choice as any Feel free to use another language if you can do better.

Explaining pass-by-reference using Java, which can't express pass-by-reference, is one of the sources of the confusion people here are experiencing (the other is Java using reference to mean something different from established meanings).


"Clearly reading the JLS wasn't good enough for most people. So what do you turn to when people take a well-established programming term like "pass-by-reference" and apply it where it doesn't belong?"

Clearly, one should turn to computer science fundamentals. Considering the totality of your posts under this article and the responses to them, picking the language with arguably the most complex panoply of ways to denote values, of any language in common use, hasn't worked out as a pedagogical device.


Clearly, others in this thread need something more accessible than computer science fundamentals. I believe, if that were enough, they would have understood the terms correctly from the start (because the terms are rooted in computer science fundamentals - the confusion only arises once you confuse them with Java terminology).

So do not conflate what you consider clear with what the thread is reflecting as clear. They are quite different.


What the threads reflect is that you have repeatedly abandoned this approach:

'Please learn Java. It's not about not knowing other languages. It's about not knowing Java. This is all in the JLS.'

'Read the JLS. This is Java as defined by its creators, absent of C++.'

I think you are being particularly clear in that last one.


I think you are being naive if you think people who don't understand the definitions of "pass-by-value" and "pass-by-reference" (terms well-defined and well-understood in programming language theory and computer science fundamentals), and then go on to further misunderstand an article about Java and C++, will get any benefit from discussion on the topic that avoids Java, C++, or any other concrete examples, and instead tries to use the very definitions themselves (which are not understood, remember?) to try to provide clarity.

As I said before, if people understood the fundamentals, or if the fundamentals were good enough, then this entire thread wouldn't exist. This stuff is child's play. Anyone who is confused by this needs more help than shrugging and saying "stop trying, just point them at more fundamentals"...


You appear to have put this post in the wrong place, as it says nothing that relates to the observation presented in the parent, which is that elsewhere, you ultimately abandoned your C++-analogy approach in favor of one that discusses Java in Java terms -e.g. 'Read the JLS. This is Java as defined by its creators, absent of C++.'

Which is not to say that there is anywhere this post belongs, as you attempt to use a couple of tired old rhetorical ploys: insinuating a position that has not been stated, and the insertion of a specific item into a list of disjunctions in the hope of insinuating that it is necessary.

Your argument here depends on the misunderstanding that all explanations in computer science are abstract, and specifically that they are inevitably more abstract than a discussion of the same topic in C++. That is not so; a discussion of argument-passing can be (and is) done in terms of addresses and stack frames. That's more concrete than 'abstract pointers', and also more straightforward than making qualified analogies between elements of Java and C++, which are of no help to anyone who doesn't have a solid understanding of C++, anyway.

This is just as well, or how else would anyone have understood this stuff before they had C++?


What in the world are you talking about?

> you attempt to use a couple of tired old rhetorical ploys

I do no such thing.

> Your argument here depends on the misunderstanding that all explanations in computer science are abstract

Not at all.

> That is not so; a discussion of argument-passing can be (and is) done in terms of addresses and stack frames.

Sure you could do it that way. But it becomes exponentially more complicated because you need to either stick to one specific implementation of one specific language runtime, or you have to deal with explaining them all. Neither is ideal.

> are of no help to anyone who doesn't have a solid understanding of C++, anyway

You just need a basic understanding. This isn't advanced stuff here. People learn Java's object references the very first time they

    Thing x = y; y->something(); // Why has x changed?
and they learn C++ references and pointers ... well from the start.

These are week-one concepts for anyone learning the languages.

> This is just as well, or how else would anyone have understood this stuff before they had C++?

Most people have no trouble understanding the concept in week one of Java, or C++, or whatever other language they are learning. And the rest get it from the fundamentals. But those aren't the people in this thread who continue to confuse the issue.

If someone can't take the phrase "pass-by-reference" and the phrase "Java object reference" and understand that the two uses of the word "reference" mean different things, even after reading the simple-to-understand definitions of each, then they really need above-and-beyond help. This isn't "dive into CS theory" or "show them the machine-level stack frames and register contents", this is "try whatever you can that might help them". C++ is a very valid place to go for these folks.


Good day to you, too! You haven't disappointed in the latest of your daily diatribes!

'What in the world are you talking about?'

Here we have another common rhetorical ploy, the attempt to insinuate that the other party is not making sense, without actually refuting her arguments. If not used carefully, however, it has the unfortunate side-effect of giving the impression that you alone cannot figure it out.

But do keep the snide asides coming (not that I think you are likely to stop). If it were not for them, I would have left this thread long ago, satisfied that we had reached an amicable agreement to disagree.

You follow with a few flat denials of things I wrote. You can do that until the cows come home, but unless you can offer actual refutations of the arguments I presented in support of those claims, you are just blowing hot air.

'Sure you could do it that way. But it becomes exponentially more complicated because you need to either stick to one specific implementation of one specific language runtime, or you have to deal with explaining them all.'

Now we come to something that has the verisimilitude of a rational argument, and we can immediately see why you were reluctant to go there, despite the manifest failings of the alternatives you tried. The first question that comes to mind is, exponential in what? What, precisely, leads to an exponential growth in complexity? Note that the sentence quoted here claims exponentially more complication even if you stick to one specific implementation of one specific language runtime, so make sure that your explanation covers that case, or I will have to return to it. Also make sure that your explanation somehow avoids applying to C++, and covers how we ever managed to figure this all out before we had C++.

Furthermore, the implication that it has to be presented using one extant runtime or another is fallacious. One can discuss argument passing using stack frames and addresses without getting into how C++ or any other specific language implements it, and the empirical proof of that can be found in any number of elementary comp. sci. textbooks.

Your 'its so simple' argument is a non-sequitur, as you are making the fallacy that if the concept is simple, then any explanation will be simple. In reality people can, and do, tie themselves in knots over simple issues - Zeno's paradoxes are a case in point. In fact, the simplicity argument goes against you - it's so simple, yet you ended up retroactively qualifying your use of pointer as 'abstract pointer' and spend time in drawing analogies between C++ pointers and Java references.

And if its so simple, how come that there are people who are just not getting it? Maybe, just maybe, the problem is in how it is presented.

The question of whether an approach via C++ is helpful, and whether your particular approach (using qualified analogies between C++ and Java) helps, are separate issues. I could go into how well your approach worked in practice, though I don't think that is necessary at this point (unless you choose to go there), except to point out that you repeatedly abandoned this approach in favor of a purely Java one, telling people to 'read the JLS.'


I didn't even bring up C++ - the article did, dlubarov commented about it, and you asserted that C++ references and Java references were the same. That's where I joined - to correct your fallacy.

Perhaps it really is simple, and you are afraid to admit that maybe you didn't get a simple concept either, until your eyes were opened by the very posts you spend walls of text refuting. I know it is not a pleasant feeling, but it's acceptable to own up to it. No amount of text or thesaurus consultation will fix your mistake.

Or, if that's too much pride for you to abandon, then you can continue to stand behind your original claim that references in C++ and Java are the same for this discussion (or any other - but I posit that there is no discussion, except for maybe "the word reference in both phrases has the same spelling"), then I feel for you. I really do.

Good day!


You were correct on the references issue (which was not as you present it here, which is typical), but mistaken over the cause of length of this thread, which comes from an unbroken series of faulty arguments you presented in an attempt to support the notion that using C++ was the only option in explaining the issue. The last one was a risible claim about the literally exponential complexity of the alternatives.

So here's a difference between us: I freely acknowledge correct arguments, while you silently slink away from your mistakes, and try to pretend you never made them. I am happy to have third parties figure out who is being immature here.

Top O' the morning to you!


Every one of my corrections was accurate.

I also don't believe I ever claimed that C++ was the option.

I own up to my mistakes the instant they are apparent. If you believe I should be owning up to something but I haven't yet, it is because either I wasn't wrong, or the argument against me wasn't coherent.

But at least you finally capitulated. I didn't think you would, so you at least proved me wrong there.


I am hugely amused that you just could not resist making a statement that proves it is you who suffers from the obsession you accuse me of (not that there was any real doubt.) You remind me of the child who just cannot resist the marshmallow: https://www.youtube.com/watch?v=0mWc1Y2dpmY


Are you claiming that if I hadn't corrected your false statements quickly, and instead I had waited a short while, that you would have made additional false statements that you wouldn't otherwise have made? So that I could have enjoyed correcting you even more?

If that's true then I wish you would have said that up front like the experimenter in the video. Unlike the subjects, I would have had no problem delaying that gratification. My prize would have beaten a marshmallow any day.


Most people figure out as children that claiming the truth of something that is demonstrably false is a losing strategy. It doesn't even count as a rhetorical ploy; 'Go directly to fail' would be a more appropriate characterization.

A simple reading of this thread shows that I have merely been responding to specific claims of yours, in which the comparison of references was neither here nor there, once you chose to make an issue of whether your C++-comparison based explanation was the only feasible one remaining. When you could have left it as an amicable difference of opinions, you chose to double-down and insist that anything other than your opinion was flat-out wrong, which led you to make a series of increasingly poor arguments, culminating in the ridiculous claim that the alternatives would literally be exponentially more complex.

In each case (including the last), after I pointed out the flaws in your claims, you have neither accepted the point, nor offered any counter-argument. Instead, you circled around and tried to make a different argument for the same claim, as if there was not already a growing pile of refutations stacking up against it. If there was any doubt before that you suffer from the obsession you accuse me of, you effectively removed it by this behavior.

There is not much point in discussing anything with someone like you, but your sanctimonious rudeness to me and others makes it worthwhile.

'My prize would have beaten a marshmallow any day.' No surprise there - your juvenile motivations are plain for anyone to see.


> Most people figure out as children that claiming the truth of something that is demonstrably false is a losing strategy.

So the video had no point then? Because the video I saw was about delayed gratification, not the strategy of truths and falsehoods.

And I still await a clear idea of where I made a claim of truth and was mistaken. As I've said in the past, if you can show me that clearly, I'll capitulate. I've been patiently waiting through all of your long-winded responses for this, and have been disappointed so far.

In fact, you now have changed your characterization of my posts from "truths and claims" to "opinions", which most of them were all along (the only claim I believe I made that could be considered fact instead of opinion was the refutation of your C++ references-and-pointers equation, which you agreed I was correct on).

> A simple reading of this thread shows that I have merely been responding to specific claims of yours

I don't see that anywhere, actually.

> once you chose to make an issue of whether your C++-comparison based explanation was the only feasible one remaining

I also don't see this anywhere. What I do see is my claim that C++ is a useful comparison - but nowhere do I see myself claiming it is the "only" one, or the "only feasible" one.

Some of my quotes have been: "for the purposes of this discussion, it is very useful and illustrative to equate pass-by-reference to C++ references, and object references to C++ pointers, because the languages are similar and the concepts match up very well, and because these things are more explicit in C++" and "Seems like C++ is as good a choice as any" and "one could have defined everything without comparing to C++"...

> after I pointed out the flaws in your claims, you have neither accepted the point, nor offered any counter-argument

But you haven't actually pointed out any flaws in any of my claims.

> as if there was not already a growing pile of refutations stacking up against it

Please, point out the pile of refutations to the claim that C++ is useful in this discussion (not "only", just "useful)... especially since, refuting the notion that it is useful to someone means finding everyone who read it and getting them to admit that they found no use in it. If you do that, I'll certainly admit I was wrong.

> your sanctimonious rudeness

I see very little rudeness - the only clear cut case was in response to someone else who basically asked me what rudeness would look like and I gave an example referencing proggit. Care to quote any specific rudeness toward you? Be careful not to equate an unpleasant discussion with rudeness.

> your juvenile motivations

If you think truth is a juvenile motivation then I finally understand everything you've written.


Your attempt to deny what you wrote is as revealing as it is pathetic. The record stands for itself.


I was going to write the same thing.


Instead of replying in a manner I haven't heard since middle school, you could be writing a much-delayed explanation of your claim that a stack-frames-and-addresses explanation of pass-by-value would necessarily be "exponentially more complicated" than your C++-based approach.


I guess I am the middle schooler here because I'm going to point out that "you started it".

I won't even dwell on the hypocrisy of you trying to call me out for my rudeness right before you post this middle school nonsense.

If you don't think stack frames and addresses are far more complex a learning tool for this than references and pointers, that's your opinion. I disagree, and I think many would, but there's no factual claim here for you to refute, no matter how much you are grasping for one in this thread.

Go ahead and explain it your way to folks. See if it finally sinks in for those who didn't get it from the JLS or from the article. I'd be happy to watch the attempt. I don't think it'll work. Prove me wrong.




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

Search: