[m-rev.] for review: support different clauses for different modes

David Overton dmo at cs.mu.OZ.AU
Wed May 16 11:16:52 AEST 2001


Hi Fergus,

The code looks fine to me.  I have a few minor corrections to the
documentation thought:

On Wed, May 16, 2001 at 06:17:58AM +1000, Fergus Henderson wrote:
> Index: NEWS
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/NEWS,v
> retrieving revision 1.207
> diff -u -d -r1.207 NEWS
> --- NEWS	2001/05/02 17:34:26	1.207
> +++ NEWS	2001/05/15 18:33:17
> @@ -7,6 +7,21 @@
>  of our CVS repository (the `version-0_10_y' branch).
>  
>  Changes to the Mercury language:
> +* We've extended the language to allow you to specify different clauses
> +  for different modes of a predicate or function.  This is done by
> +  putting a determinism annotation in the head of each clause.

s/a determinism annotation/mode annotations/

> Index: doc/reference_manual.texi
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
> retrieving revision 1.205
> diff -u -d -r1.205 reference_manual.texi
> --- doc/reference_manual.texi	2001/04/29 07:54:29	1.205
> +++ doc/reference_manual.texi	2001/05/15 20:12:18
> @@ -2040,6 +2057,116 @@
>  
>  The mode analysis algorithm annotates each call with the mode used.
>  
> + at node Different clauses for different modes
> + at section Different clauses for different modes
> +
> +Because the compiler automatically reorders conjunctions to
> +satisfy the modes, it is often possible for a single clause
> +to satisfy different modes.  However, occaisionally reordering

s/occaisionally/occasionally

> +
> +In the example with @samp{append} above, the two ways of implementing
> +append do have the same declarative semantics, so we can safely use
> +the first approach:
> +
> + at example
> +	:- pragma promise_pure(append/3).
> + at end example
> +
> +In the example with @samp{var/1} above, the two clauses have different
> +semantics, so the predicate must be declared as impure:
> +
> +	:- impure pred var(T).
> +

This declaration should be in an '@example' environment.


-- 
David Overton      Department of Computer Science & Software Engineering
PhD Student        The University of Melbourne, Victoria 3010, Australia
+61 3 8344 9159    http://www.cs.mu.oz.au/~dmo
--------------------------------------------------------------------------
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