Re: on call by reference

Liste des GroupesRevenir à cl scheme 
Sujet : Re: on call by reference
De : alan (at) *nospam* csail.mit.edu (Alan Bawden)
Groupes : comp.lang.scheme
Date : 20. Mar 2024, 05:08:35
Autres entêtes
Organisation : ITS Preservation Society
Message-ID : <86y1adppl8.fsf@williamsburg.bawden.org>
References : 1
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Scheme is call-by-value.  Python is call-by-value.  Java is
call-by-value.  C is call-by-value.  In none of those languages can you
write a procedure that assigns a variable used as an argument to that
procedure.  Read that carefully.  "Assigns" means to change what the
variable references.  "Assigns" does _not_ mean to make modifications to
the thing that the variable references.  In Python terms "x = 4" is an
assignment to "x", but "x[1] = 4" is not an assignment to "x" because
afterwards "x" still references the same object.

English is a bit slippery here, so people often find this distinction
confusing.  To make it clearer ask yourself what it means to "change
your socks".  Does it mean you took your socks off and put on a
different pair?  Or does it mean you dyed the socks you are wearing a
different color?

A call by value language doesn't let you put on a different pair of
socks, it only lets you dye them a different color.

- Alan

Date Sujet#  Auteur
19 Mar 24 * on call by reference19Johanne Fairchild
20 Mar 24 +- Re: on call by reference1Lawrence D'Oliveiro
20 Mar 24 +* Re: on call by reference3Dmitri Volkov
20 Mar 24 i+- Re: on call by reference1Lawrence D'Oliveiro
20 Mar 24 i`- Re: on call by reference1Schol-R-LEA
20 Mar 24 +* Re: on call by reference4Alan Bawden
20 Mar 24 i`* Re: on call by reference3Johanne Fairchild
21 Mar 24 i `* Re: on call by reference2Alan Bawden
21 Mar 24 i  `- Re: on call by reference1Johanne Fairchild
20 Mar 24 `* Re: on call by reference10Schol-R-LEA
20 Mar 24  +* Re: on call by reference5Schol-R-LEA
21 Mar 24  i`* Re: on call by reference4Chris Vine
21 Mar 24  i `* Re: on call by reference3Lawrence D'Oliveiro
22 Mar 24  i  `* Re: on call by reference2Chris Vine
22 Mar 24  i   `- Re: on call by reference1Lawrence D'Oliveiro
21 Mar 24  +* Re: on call by reference2Alan Bawden
21 Mar 24  i`- Re: on call by reference1Schol-R-LEA
21 Mar 24  `* Re: on call by reference2Lawrence D'Oliveiro
21 Mar 24   `- Re: on call by reference1Schol-R-LEA

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal