Sujet : on call by reference
De : jfairchild (at) *nospam* tudado.org (Johanne Fairchild)
Groupes : comp.lang.schemeDate : 19. Mar 2024, 10:55:18
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <877chyiosp.fsf@tudado.org>
I tried to answer whether Scheme was call-by-reference and I did not
think the definition of call-by-reference seen on the web is precise
enough. For instance,
Call by reference (or pass by reference) is an evaluation strategy
where a parameter is bound to an implicit reference to the variable
used as argument, rather than a copy of its value. This typically
means that the function can modify (i.e., assign to) the variable used
as argument—something that will be seen by its caller.
Source:
https://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_referenceIt doesn't say how the modification is done. So we can say that Python
is call-by-reference, but surely not whe the data is imutable---then
Python is sometimes call-by-reference. Just this observation already
makes a language sometimes call-by-reference and sometimes not. So
``Is Scheme call-by-reference?''
would not make any sense. We can change data by way of its
argument---set-car!, say. On the other hand, in Scheme arguments are
passed with an implicit reference to the variable, so it is
call-by-reference, except perhaps when the argument is immutable.
So I am totally confused. These definition seem like a mess.
Can you point me out to good definitions you might know of in academic
books on the subject? Thank you.