Path: ...!news.roellig-ltd.de!news.mb-net.net!open-news-network.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: technology discussion =?utf-8?Q?=E2=86=92?= does the world need a "new" C ? Date: Thu, 26 Sep 2024 21:28:32 -0700 Organization: None to speak of Lines: 129 Message-ID: <87r095sosv.fsf@nosuchdomain.example.com> References: <87ikxconq4.fsf@bsb.me.uk> <20240711115418.00001cdf@yahoo.com> <20240712045301.394@kylheku.com> <87sewesg89.fsf@nosuchdomain.example.com> <865xresvxz.fsf@linuxsc.com> <87h6ay3jaz.fsf@nosuchdomain.example.com> <87mskqtip3.fsf@bsb.me.uk> <8634m0ccjc.fsf@linuxsc.com> <87zfo7rija.fsf@nosuchdomain.example.com> <867cay74m4.fsf@linuxsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 27 Sep 2024 06:28:42 +0200 (CEST) Injection-Info: dont-email.me; posting-host="1366c00d6f20d908d4f0926f3b327eea"; logging-data="639236"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/NPnyMysupXGVlDSaAYmTt" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:yg+OwMu1/ECvn3S21H1+sL5uOQs= sha1:L0AjJo8y1/+2nxRPcAler7NKjtg= Bytes: 7653 Tim Rentsch writes: > Keith Thompson writes: [...] >> I honestly do not understand the argument you're making in favor of >> "call by" over "pass by". ("Hoi polloi"? Seriously?) >> >> Procedures and functions are "called", yes? They're not "passed", >> except perhaps as an argument to another procedure or function. >> >> Arguments to procedures and functions are "passed", yes? Would it >> make sense to say that an argument is "called"? (I note that the >> Algol 60 report never refers to parameters being "called" other than >> in the phrases "call by value" and "call by name".) >> >> If you think that "calling an argument" or "calling a parameter" >> makes sense, perhaps that's the root of the disagreement. Do you? >> >> In most languages that supports by both by-value and by-reference >> mechanisms, a single call can have one by-value argument and one >> by-reference argument, or any other combination. Using C++ as a >> convenient example: >> >> void func(int by_value, int& by_reference) { /* ... */ } >> int x, y; >> func(x, y); >> >> In the third line, there is just one call, but two arguments, >> corresponding to two parameters. It's not the call that's by-value >> or by-reference, it's each argument that's *passed* (using the >> mechanism specified on the parameter). >> >> Other than historical precedent from Algol and friends, why do you >> think it's better to use "call by value" and "call by reference" >> rather than "pass by value" and "pass by reference", when the >> mechanism applies individually to each argument, not to the call as >> a whole? >> >> Do you object to using the word "pass" (without "by ...") to refer >> to the arguments to a function? If not, why do you object to "pass >> by ..." to refer to the mechanism? > > After reading your message I spent several hours thinking about how > to answer before starting to write a reply. I ask that you take a > commensurate amount of time considering my comments before composing > any followup. I'm not sure what would qualify as "commensurate". I've read your message at least twice. I will not spend several hours on it, because I do not think that would be worthwhile. > I think it's fair to say we are looking at this question from > different perspectives. I see where you're coming from; I get > why you're saying what you say. For the other direction my guess > is that my perspective either isn't apparent or isn't one that > makes sense to you. Let me see if I can shed some light on that. I'm glad that you can see where I'm coming from. I regret that I cannot say the same. > The "call by" in Algol 60 is used to characterize /parameters/ of > a function definition. It's important that "call" is used in the > active voice; parameters are not "called". https://dl.acm.org/doi/pdf/10.1145/367236.367262 4.7.5.4. A formal parameter which is called by value cannot in general correspond to [...] Apparently the author of that section did think that parameters (at least formal parameters) are "called", or did not clearly express what he actually meant. It's a minor point. I certainly understand that Algol 60's "call by" terminology refers to parameters. [...] > Saying "pass by" sort of works okay for parameters that are > by-value or by-reference. It doesn't work as well for "by name" > parameters (certainly it is not a name that is being passed), and > really falls down for call by value-result, let alone what happens > with call by unification. Parameters are call-by because they can > affect how the function is called, both going in and going out. > Call-by shows an abstract semantics perspective rather than an > implementation perspective, and because of that applies more > universally than pass-by, which doesn't make sense outside of > a certain limited procedural context. The mode (by value, by reference, by name) refers to *each individual parameter" in a function (or procedure, or subprogram) call. > I guess I'll stop here. I've made a fairly substantial effort to > convey my perspective, but I'm not sure the effort will succeed. > So let me ask this: how would you describe my perspective, and > how would you say it's different from yours? Or has reading my > explanation allowed you to view the question from a different > perspective? After reading your message more than once, I still don't understand why you think that "call by" is clearer than "pass by". I can see that "pass by" might not completely and correctly describe the mechanism in the case of some mechanisms other than by-value, but I don't see how "call by" is better. Again, arguments are passed, not calls; saying that a parameter is "call by foo" just doesn't make sense to me. "Pass by" certainly (in my opinion) makes more sense for C, which only has by-value. In K&R (both editions), the header for section 1.8 is "Arguments -- Call by Value", but in the first paragraph of that section we see "In C, all function arguments are passed “by value.”" My speculation is that Kernighan used "Call By Value" in the header because that was the conventional term at the time, but "passed by value" in the text because it makes more sense. I won't ask you to reply to this. I think it's unlikely that further discussion is going to be productive. *If* you can explain *in one short paragraph" why you think "call by" is better than "pass by", that might be useful, but I'm not optimistic. Since you and I have a tendency to talk past each other, perhaps someone else can summarize the issue, but again, I'm not asking anyone to spend the time to do that. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */