[m-rev.] for review: improve purity documentation
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Mar 13 13:57:52 AEDT 2002
On 13-Mar-2002, Peter Schachte <schachte at cs.mu.OZ.AU> wrote:
> > doc/reference_manual.texi:
> > Improve the documentation regarding purity.
>
> This looks good to me, except one nit:
>
> > @item semipure
> > Semipure predicates are just like pure predicates, except that their
> > -behaviour may be affected by the invocation of impure predicates. That
> > -is, they are sensitive to the state of the computation other than as
> > -reflected by their input arguments, though they do not affect the state
> > -themselves.
> > +declarative semantics may be affected by the invocation of impure
> > +predicates. That is, they are sensitive to the state of the computation
> > +other than as reflected by their input arguments, though they do not
> > +affect the state themselves.
>
> Haven't we said in the past that impure and semipure predicates have
> no declarative semantics, only operational semantics?
No. Impure predicates have no declarative semantics.
But semipure predicates have a "contextual" declarative semantics.
As the reference manual says:
| Semipure goals can be given a "contextual" declarative semantics.
| They cannot have any side-effects, so it is expected that, given the
| context in which they are called (relative to any impure goals in the
| program), their declarative semantics fully captures the intent of the
| programmer. Thus a semipure goal has a perfectly consistent declarative
| semantics, until an impure goal is reached. After that, it has another
| (possibly different) declarative semantics, until the next impure goal
| is executed, and so on. Mercury compilers must respect this contextual
| nature of the semantics of semipure goals; within a single context, a
| compiler may treat a semipure goal as if it were pure.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list