Path: ...!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Schol-R-LEA Newsgroups: comp.lang.scheme Subject: Re: on call by reference Date: Wed, 20 Mar 2024 21:00:20 -0400 Organization: A noiseless patient Spider Lines: 30 Message-ID: References: <877chyiosp.fsf@tudado.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 21 Mar 2024 01:00:20 -0000 (UTC) Injection-Info: dont-email.me; posting-host="e0a575d7620ab5e169a2a9922223a30b"; logging-data="1914672"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19BPWHv0xQ3goxGB+8RptYpGH2zxpeADsU=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:hEkcAwBUJECFFMvivmpCoEGB9wk= In-Reply-To: Content-Language: en-US Bytes: 1955 Lawrence D'Oliveiro: > On Wed, 20 Mar 2024 10:57:18 -0400, Schol-R-LEA wrote: > >> Languages such as C and C++ are interesting in this regard, as they have >> only call-by-value semantics, but also support passing explicit >> pointers, which allows them to simulate call-by-reference semantics by >> the passing of explicit pointers. > > C++ allows “references”, where the “pointer” part is no longer explicit. > E.g. > > ResType Func > ( > ArgType & Arg > ) > { > ... > } /*Func*/ > > But of course this is not tied to function arguments at all, and can be > used elsewhere, e.g. > > int A; > int & const B = A; > > Now any assignment to “B” actually changes the value of “A”. I had forgotten about C++ opaque references. Thank you for pointing that out.