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

I was simply saying that C++ using a certain terminology was a sufficient condition for C++-derived languages to use the same terminology, you wouldn't need a CS-wide definition for this and your small set of language wouldn't allow you to make the inference that such a common definition existed.

BTW the page you've linked seems to contradict some of your statements:

> so they are typically described as call by value even though implementations frequently use call by reference internally for the efficiency benefits

As you seem to be arguing that this is not call by reference you should probably correct the page.

EDIT: It also seems that there IS some amount of language specificity anyway, since in another place of the page it says:

> "In particular it is not call by value because mutations of arguments performed by the called routine will be visible to the caller. And it is not call by reference because access is not given to the variables of the caller, but merely to certain objects"

I'm reasonably sure that the first part would be called "call by value" in C++ even if in context of CLU it wasn't if the usual way of doing the same in C++, namely passing a pointer to an object, were to be used.



> As you seem to be arguing that this is not call by reference you should probably correct the page.

I don't really disagree with what the article says there, although I don't like the way it's phrased. The full quote:

> In purely functional languages there is typically no semantic difference between the two strategies (since their data structures are immutable, so there is no possibility for a function to modify any of its arguments), so they are typically described as call by value even though implementations frequently use call by reference internally for the efficiency benefits.

A purely functional language with the property of referential transparency [0] can indeed be treated as using pass-by-value, or pass-by-reference, or even some blend of the two. With referential transparency, nothing hinges on which of the two strategies is used. I'm not sure it's accurate to say that they're typically described as call by value.

> there IS some amount of language specificity anyway

As Wikipedia says, the term call by sharing is not as widespread. I hadn't seen it before. I can't say I really see where they're going with that term:

> In particular it is not call by value because mutations of arguments performed by the called routine will be visible to the caller.

No, they aren't. In Java, you can pass an object reference to the callee function, and the reference will be passed by value. The callee function can modify the members of the referred-to object, in a way that may later be visible to the caller function. So what? That's still pass-by-value. It's the same in C, where the callee can modify a pointed-to variable.

The Wikipedia article also appears to suggest that in Java, all arguments are boxed/unboxed when passed. That isn't true.

I can see some sense in having a term to emphasise that Java sometimes performs boxing, rather than simple pass-by-value. This is to say, I agree that it's a slight oversimplification to say that Java always simply passes by value. If we go too far down this road though we'll need to recategorise C, as it allows implicit conversions between many of its primitive types.

> you should probably correct the page

I don't have the will to get into a Wikipedia edit war, which is how this kind of thing often goes.

[0] https://en.wikipedia.org/wiki/Referential_transparency




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: