Re: By value-result vs by reference

nebbe@lglsun.epfl.ch (Robb Nebbe)
Fri, 22 Apr 1994 11:06:04 GMT

          From comp.compilers

Related articles
By value-result vs by reference guerin@iro.umontreal.ca (1994-04-21)
Re: By value-result vs by reference graham@pact.srf.ac.uk (1994-04-21)
By value-result vs by reference ssimmons@convex.com (1994-04-21)
Re: By value-result vs by reference hbaker@netcom.com (1994-04-21)
Re: By value-result vs by reference Dik.Winter@cwi.nl (1994-04-21)
Re: By value-result vs by reference nebbe@lglsun.epfl.ch (1994-04-22)
Re: By value-result vs by reference andrewd@apanix.apana.org.au (1994-04-24)
Re: By value-result vs by reference hbaker@netcom.com (1994-04-23)
Re: By value-result vs by reference nebbe@lglsun.epfl.ch (1994-04-26)
Re: By value-result vs by reference Theo.Norvell@comlab.oxford.ac.uk (1994-04-26)
Re: By value-result vs by reference hbaker@netcom.com (1994-04-28)
Re: By value-result vs by reference anton@mips.complang.tuwien.ac.at (1994-04-29)
[2 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: nebbe@lglsun.epfl.ch (Robb Nebbe)
Keywords: design
Organization: Ecole Polytechnique Federale de Lausanne
References: 94-04-140 94-04-145
Date: Fri, 22 Apr 1994 11:06:04 GMT

hbaker@netcom.com (Henry G. Baker) writes:
Background: in Ada programs that depend on whether a parameter is passed
by reference or value/result (mode in out only) are considered erroneous.


: The biggest weasel hole around is in Ada, which refuses to take a stand at
: all, and therefore if your program can tell the difference, it is
: 'erroneous'.


The difference only comes up when you start aliasing variables by doing
things like nesting a procedure in another procedure and using the fact
that the parameters of the enclosing procedure are global to the enclosed
procedure and the fact that later on the enclosing procedure will call the
enclosed procedure thus providing two different ways to access the same
entity.


Any time you have concurrent acces to a single entity you run into
synchonization problems if precautions are not taken. The fact that this
can happen in the same thread of control because of the method of passing
parameters is unfortunate.


As another poster mentioned you have to look at the semantics of the whole
language. The problem I see is that aliasing makes the difference between
reference and value/result evident. To what extent aliasing is needed
(especially aliasing without any precautions) is open to debate but I
don't think we can leave all the blame on the door step of value/result.


A good question would be how often a programmer can unknowingly alias a
variable thus creating an implicit dependency of the method of parameter
passing.


: In a world of ever-changing hardware, where machines with 16, 32 and 64
: bits must coexist, the only safe policy is a consistent semantics which
: can then be implemented using every trick in the book.


- Robb Nebbe
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.