Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!mcvax!diku!daimi!pdm
From: pdm@daimi.UUCP (Peter Mosses)
Newsgroups: comp.lang.misc
Subject: Re: H.O.Functions + Polymorphism
Message-ID: <844@daimi.UUCP>
Date: Mon, 13-Jul-87 04:40:34 EDT
Article-I.D.: daimi.844
Posted: Mon Jul 13 04:40:34 1987
Date-Received: Wed, 15-Jul-87 04:15:06 EDT
References: <...> <2637@crcge1.UUCP>  <1345@ogcvax.UUCP> <1332@ssc-vax.UUCP>
Reply-To: pdm@daimi.UUCP (Peter Mosses)
Organization: DAIMI: Computer Science Department, Aarhus University, Denmark
Lines: 42
Keywords: parameter-passing, lambda-notation, denotational semantics

In article <1332@ssc-vax.UUCP> dickey@ssc-vax.UUCP (Frederick J Dickey) writes:
>Years ago I was interested in programming language semantics, in particular,
>"fixed-point" semantics (I was a theory guy). My recollection is that
>"lazy evaluation"-type parameter passing strategies are much easier to 
>describe formally than the way parameter passing is usually done in imperative 
>languages.  This was, to me at least, a counterintuitive result, since 
>the "normal" way of passing parameters seems a lot simpler. I am inclined
>to regard this clash between theory and practice as a "hint" from theory 
>that there is something wrong with the conventional view of parameter passing.

In denotational (fixed point) semantics, the notation conventionally
used for specifying denotations is lambda-notation, which itself has
call-by-name parameter-passing.  This property of lambda-notation can,
in simple cases, be exploited to give a simple semantic description of
call-by-name parameter-passing in programming languages.

However, it is _almost_ as easy to specify that parameters are to be
evaluated in advance (just by making a function "strict").  There is
also an alternative lambda-notation (due to Gordon Plotkin) for
partial functions, where parameter evaluation is done in advance,
allowing a simple description of the same concept (call-by-name is
then specified by putting the parameter in a function abstraction).

In practice, "continuations" are used in denotational semantics to
express order of evaluation .  Then it is equally simple to specify
the above alternatives.  What complicates the semantics of (Algol,
Pascal) "call-by-value" is that it involves the allocation of a local
variable to hold the value of the parameter.  By the way, "call-by-
need" (where the parameter is evaluated _at most_ once, the first time
its value is needed in the body) has an even more complicated semantics.

Semantic description is one thing; program verification is something
else.  Perhaps the simpler substitution properties of "call-by-name"
(compared to "call-by-value") might make it easier to reason about
program equivalence/correctness?  Otherwise, "theory" doesn't seem to
be giving any hints about which parameter-passing mechanisms are right
or wrong.
-- 
Peter Mosses						pdm@daimi.uucp
----------------------------------------------------------------------
[ Computer Science Department * Aarhus University * Aarhus * Denmark ]
----------------------------------------------------------------------