Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!fas-news.harvard.edu!newspump.wustl.edu!trinews.sbc.com!wupost!udel!news.mathworks.com!hookup!olivea!news.hal.COM!decwrl!adobe!macb307.mv.us.adobe.com!user
From: mhamburg@mv.us.adobe.com (Mark Hamburg)
Subject: Re: call by value, again
Message-ID: <mhamburg-151194091125@macb307.mv.us.adobe.com>
Followup-To: comp.lang.scheme
Sender: usenet@adobe.com (USENET NEWS)
Organization: Adobe Systems, Inc.
References: <3a0mh8$prv@agate.berkeley.edu> <BLUME.94Nov11170247@dynamic.cs.princeton.edu> <BLUME.94Nov14113359@dynamic.cs.princeton.edu>
Date: Tue, 15 Nov 1994 17:20:06 GMT
Lines: 35

Or think about it this way:

A variable names a storage cell.  (Specifically part of an environment.) 
This is exactly the same as in Pascal.

A storage cell contains a reference to an object.  This is essentially a
restriction from Pascal since a Pascal variable storage cell could contain
an object such as a record or an array.

Scheme is call-by-value because it has no provision for passing references
to variable storage cells.  It only passes the contents of variable storage
cells.  (This is essentially the whole L-value/R-value distinction.)

Since anyone building dynamic data structures in Pascal would have dealt
with pointers, I don't see that there is a problem.

Now, Matthias has gone on to note that when building closures, a variable
may actually end up referring to more than one cell.  This can be viewed in
a couple of ways:

1. Every use of a variable names a specific storage cell.

2. If I never change the value of x after initializing it, then I am
perfectly free -- i.e., the meaning of the program doesn't change -- to
create another variable x-copy which is initialized to the same value as x
and which is used selectively in place of x, e.g., inside a procedure for
which I need to build a closure.

(Real Scheme's don't generally use pointers all the time either since small
integers are usually encoded into the pointers themselves.  This can be
viewed as an optimization, however, in which we have pre-initialized a
range of memory -- which we will never actually access -- with whatever
range of small integers is being supported.)

Mark
