Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!panix!zip.eecs.umich.edu!newsxfer.itd.umich.edu!gatech!willis.cis.uab.edu!news.ecn.bgu.edu!siemens!princeton!news.princeton.edu!blume
From: blume@dynamic.cs.princeton.edu (Matthias Blume)
Subject: Re: call by value, again
In-Reply-To: bh@anarres.CS.Berkeley.EDU's message of 14 Nov 1994 02:40:22 GMT
Message-ID: <BLUME.94Nov14113359@dynamic.cs.princeton.edu>
Originator: news@hedgehog.Princeton.EDU
Sender: news@Princeton.EDU (USENET News System)
Nntp-Posting-Host: dynamic.cs.princeton.edu
Organization: Princeton University
References: <3a0mh8$prv@agate.berkeley.edu> <BLUME.94Nov11170247@dynamic.cs.princeton.edu>
	<3a5eff$k52@agate.berkeley.edu>
	<mhamburg-131194164808@macb022.mv.us.adobe.com>
	<3a6imm$49h@agate.berkeley.edu>
Date: Mon, 14 Nov 1994 16:33:59 GMT
Lines: 48

In article <3a6imm$49h@agate.berkeley.edu> bh@anarres.CS.Berkeley.EDU (Brian Harvey) writes:

   mhamburg@mv.us.adobe.com (Mark Hamburg) writes:
   >Essentially, everything in Scheme is a pointer and pointers are always
		 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   >passed by value.

   When *I* said that, everyone yelled at me!  :-(

I didn't see anybody but me write anything about this, and certainly I
wasn't yelling.  I just pointed out, that the word ``pointer'' is not
part of the *definition* -- it is just one way to implement what's
defined.  However, I agree that the definition was certainly written
with the pointer-model in mind.

When I first attempted to understand Scheme -- and earlier: Lisp -- I
used the pointer-model, too.  Even today I often picture things with
little boxes and arrows.  But I also learned that this can lead to too
restricted a view of the world.

Example: It is a perfectly legal (and often practiced) technique to
*copy* the *value* of a variable into a closure data structure when
necessary.  It is legal if and only if the compiler can prove that the
value of this variable doesn't change (otherwise we would have a
consistency problem).  For local variables this can easily be done by
inspecting the scope of the variable for occurences of it on the
left-hand side of an assignment operator.

So there are actually two or more *physical* locations in *physical*
storage, which are denoted by the same variable.  The pointer model
seems to break down here.  However, by carefully adjusting what is
meant by ``location'' in the formal defintion it is possible to prove
this implementation technique correct.  (A ``location'' of the
definition would correspond to an equivalence class of physical
storage cells.)

Also note that this technique gets rid of the explicit two-level
mapping I was talking about earlier.  It does so for the cases where
it can be proved to have the same semantic properties.

   I'd be happy to say "the pointers are passed by value" but
   Matthias wants me not to say that.

Say whatever you want as long as you manage to eventually create a
correct mental picture of what's going on.

--
-Matthias
