Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: technology discussion =?utf-8?Q?=E2=86=92?= does the world need a "new" C ?
Date: Sat, 13 Jul 2024 14:43:08 -0700
Organization: A noiseless patient Spider
Lines: 86
Message-ID: <86bk316k9f.fsf@linuxsc.com>
References: <871q42qy33.fsf@bsb.me.uk> <87ed82p28y.fsf@bsb.me.uk> <87r0c1nzjj.fsf@bsb.me.uk> <87ikxconq4.fsf@bsb.me.uk> <20240711115418.00001cdf@yahoo.com> <20240712154252.00005c2f@yahoo.com> <86o7717jj1.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Sat, 13 Jul 2024 23:43:09 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="3070d615bd1460d90f058c7d1a751256"; logging-data="3952462"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX190orHSYUoXsz2Ysn+cPoj0XWE4AQwl2oY="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:2Px3FlN7yZP4eXHXyt+BwRtiMRc= sha1:KN8kOHB9i5BTsQwOFZ5oGno2ce0=
Xref: csiph.com comp.lang.c:387142
BGB writes:
> On 7/13/2024 4:01 AM, Tim Rentsch wrote:
>
>> Michael S writes:
>>
>>> On Fri, 12 Jul 2024 13:12:53 +0200
>>> Janis Papanagnou wrote:
>>>
>>>> But maybe he has looked up some things, since lately he's squirming
>>>> by introducing terms like "_true_ pass-by-reference" [emphasis by me]
>>>> obviously trying to bend the semantics of the established technical
>>>> "pass-by-reference" term to fit his argument. (Introducing new terms
>>>> for existing mechanisms or bending semantics of existing terms with
>>>> well established meaning is certainly not helpful in any way.)
>>>>
>>>> But, yes, that person is a phenomenon.
>>>
>>> I don't share your optimistic belief that the term "pass by reference"
>>> is really established. Very few terms in computer science (science?
>>> really?) are established firmly. Except, may be, in more theoretical
>>> branches of it.
>>
>> The terms
>>
>> call by name
>> call by value
>> call by reference
>> call by value-result
>>
>> are all well-defined and firmly established, going back more than
>> 60 years. I learned all of these in standard early course in
>> computer science sometime in the early 1970s. Of course I can't
>> be sure about the source after all these years, but I expect
>> they were defined in the textbook we were using in the class.
>>
>> Much later, probably under the influence of people learning
>> by reading blogs rather than books, some of these terms were
>> expressed as, eg, "pass by value" or "pass by reference".
>> However there is no indication that the change was meant to
>> express a different meaning, except insofar as the person(s)
>> using the revised terms were confused.
>>
>> Anyone who refuses to stick to the firmly established meanings
>> is in all likelihood just someone who enjoys being fractious.
>
> As I see it, they are not exactly the same:
> "call by reference", is from the POV of how arguments themselves are
> passed to functions during a function call;
> "pass by reference" has more to do with the data or object being
> conveyed (usually means that a pointer to the object is being passed,
> but generally used in cases where no explicit pointer exists).
The problem is "pass by reference" never got any sort of definitely
established meaning and people use it to mean what they think it
means. I don't see any point in trying to decide whether the two
terms mean exactly the same thing, because what people think "pass
by value" means can vary from person to person.
> "Call by reference" would be N/A for C, since this in not how C
> function calls work.
C uses call by value exclusively.
> Whereas something like object instance semantics in Java, could be
> interpreted as an example of the latter (versus primitive arguments
> which are still by-value in Java).
Java also uses call by value exclusively. What confuses some people
is that there are two kinds of values: things like integers, where
the values are represented directly; and objects, where objects are
referred to by what is called pointer semantics: the "value" of an
object variable is in effect a handle to the object memory, which is
stored somewhere else. Both integers and object handles are passed
by value. The difference is that with integers (and maybe some
other primitive types) everything about the item is right there in
the value, whereas with objects most of what makes up the state of
the object is somewhere else, and the "value" is only a link to
that. But in terms of what variables hold, and what expressions
produce, Java has call-by-value semantics for all parameters and
all arguments.
(Disclaimer: I am not a Java expert. I believe what I said about
Java is right but it may be either incomplete or a little bit off.
For that matter it might be completely wrong. :) But certainly
there are languages that behave in the way described above.)