nonlocal fails ?
Richard Damon
Richard at Damon-Family.org
Fri Nov 15 11:54:50 EST 2019
On 11/15/19 11:26 AM, Dennis Lee Bieber wrote:
> On Fri, 15 Nov 2019 12:56:02 +0100, "R.Wieser" <address at not.available>
> declaimed the following:
>
>> There are quite a number of languages where /every/ type of argument
>> (including values) can be transfered "by reference". Though some default to
>> "by value", where others default to "by reference".
>>
> Yes -- and in those languages the concept of value vs reference is
> visible at the source code level. In C, everything is passed by value --
> and the programmer uses & to pass (by value) the address of the argument,
> and uses * in the called function to dereference that address back to the
> data item itself. C++ added reference arguments (where the & is used in the
> function declaration) in which the compiler automatically applies the
> "address" and "dereference" operations.
There are languages where pass by reference is the default and not explicit.
I remember in early FORTRAN being able to do something like this (its
been years since I have done this so syntax is probably a bit off)
PROCEDURE foo(i)
i = 2
return
then elsewhere you could do
foo(j)
and after that j is 2
you also could do
foo(1)
and after that if you did
j = 1
then now j might have the value 2 as the constant 1 was changed to the
value 2 (this can cause great confusion)
later I believe they added the ability to specify by value and by
reference, and you weren't allowed to pass constants by reference,
--
Richard Damon
More information about the Python-list
mailing list