Deutsch English Français Italiano |
<v9nd45$1dpcn$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Bart <bc@freeuk.com> Newsgroups: comp.lang.c Subject: =?UTF-8?Q?Re=3A_technology_discussion_=E2=86=92_does_the_world_need?= =?UTF-8?B?IGEgIm5ldyIgQyA/?= Date: Fri, 16 Aug 2024 12:28:05 +0100 Organization: A noiseless patient Spider Lines: 52 Message-ID: <v9nd45$1dpcn$1@dont-email.me> References: <v66eci$2qeee$1@dont-email.me> <20240711115418.00001cdf@yahoo.com> <v6oamt$2d8nn$1@dont-email.me> <v6oct4$2djgq$2@dont-email.me> <v6of96$2ekb0$1@dont-email.me> <v6ovfc$2hcpf$1@dont-email.me> <v6p4hf$2icph$1@dont-email.me> <v6qgpu$2t6p7$3@dont-email.me> <v6r33m$30grj$1@dont-email.me> <20240712154252.00005c2f@yahoo.com> <86o7717jj1.fsf@linuxsc.com> <v6ti10$3gru4$1@dont-email.me> <v78af7$1qkuf$1@dont-email.me> <20240717163457.000067bb@yahoo.com> <v78piu$1su4u$1@dont-email.me> <86a5hep45h.fsf@linuxsc.com> <v9ktep$v5sk$1@dont-email.me> <87y14xsvnh.fsf@bsb.me.uk> <v9l95b$10ogv$1@dont-email.me> <87sev5s51s.fsf@bsb.me.uk> <20240816121015.0000579b@yahoo.com> <87r0aoesh4.fsf@nosuchdomain.example.com> <20240816123810.0000420d@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 16 Aug 2024 13:28:06 +0200 (CEST) Injection-Info: dont-email.me; posting-host="41b943bbe22b81dd70cf2db8d8e89fb0"; logging-data="1500567"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX189UjQjBU+kecAcs/MIU0M8" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:NL1hOoXjmHW8CqoJSvmQv2WjMC0= Content-Language: en-GB In-Reply-To: <20240816123810.0000420d@yahoo.com> Bytes: 3880 On 16/08/2024 10:38, Michael S wrote: > On Fri, 16 Aug 2024 02:18:15 -0700 > Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote: > >> Michael S <already5chosen@yahoo.com> writes: >> [...] >>> IMHO, C++ is a particularly bad example. >>> Yes, C++ has call-by-reference misfeature. But arrays in C++ are >>> 2nd class citizen, same as in C. They can't be assigned and can't be >>> passed to callee, neither by value nor by reference. >>> >>> Also, I suspect that if you ask Ken Thompson, he will tell you that >>> C++ does not really have 'call by reference'. Instead, it has >>> references as 1st class object, so, naturally, values of references >>> can be used during 'call by value'. >>> I have enough of respect to KT to consider that his POV is not a >>> nonsense. >> >> Is that an attempt at proof by authority? > > Yes! > >> Not only does Ken Thompson >> have very little to do with C++, but you're basing your conclusion on >> what you *suspect* he would say. >> > > Yes, but it's not baseless. > It is based on following section Go language FAQs that I assumed to be > either authored or approved by KT. > https://go.dev/doc/faq#pass_by_value This seems to about what happens when a language has complex, two-level types where you have a descriptor, which has a pointer to the actual data. The user may not be aware of that, and may think that passing such an object 'by-value' will copy the data. If the language only does 'shallow' pass-by-value as seems to happen here, there may be some pass-by-reference semantics. This can get confusing. However, whatever the machinations of a particular type, if a language offers *explicit* pass-by-reference, then you will always be able to provide real pass-by-reference on top. So in the case of those descriptors, it will pass a reference to the descriptor. This allows a caller to modify what's in the descriptor, and have that change visible in the caller. (My dynamic language has some 3-level types! There, reference parameters make a tangible difference.)