Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Lawrence D'Oliveiro Newsgroups: comp.lang.scheme Subject: Re: on call by reference Date: Wed, 20 Mar 2024 23:58:02 -0000 (UTC) Organization: A noiseless patient Spider Lines: 25 Message-ID: References: <877chyiosp.fsf@tudado.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 20 Mar 2024 23:58:02 -0000 (UTC) Injection-Info: dont-email.me; posting-host="badb6633f042ee08dd03f65d8f49603e"; logging-data="1883657"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ugnUeiINgyEDGAowWktXq" User-Agent: Pan/0.155 (Kherson; fc5a80b8) Cancel-Lock: sha1:j3q+HEzV9M3QzI+oCW0SWIHFE9c= Bytes: 1641 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”.