[m-rev.] for review: promise scopes (part 2)

Ralph Becket rafe at cs.mu.OZ.AU
Wed Mar 23 16:19:12 AEDT 2005


[Apologies for accidentally including way too much context before...]

Ralph Becket, Wednesday, 23 March 2005:
> Zoltan Somogyi, Monday, 21 March 2005:
> > Index: doc/reference_manual.texi
> > ===================================================================
> > +
> > + at item @code{promise_equivalent_solution @var{Vars} @var{Goal}}
> > +A determinism cast.
> > + at var{Vars} must be a list of variables.
> > + at var{Goal} must be a valid goal.
> > +This goal promises that @var{Vars} is the set of variables bound by @var{Goal},
> > +and that while @var{Goal} may have more than one solution,
> > +all these solutions aree equivalent with respect to the equality theories
> > +of the variables in @var{Vars}.
> > +The compiler checks the first part of that promise.
> > +In terms of determinism analysis,
> > + at var{Goal} is in a single solution context.
> > +If @var{Goal} has determinism @samp{cc_multi},
> > +then @code{promise_equivalent_solution @var{Goal} @var{Goal}}
> > +has determinism @samp{det};
> > +If @var{Goal} has determinism @samp{cc_nondet},
> > +then @code{promise_equivalent_solution @var{Goal} @var{Goal}}
> > +has determinism @samp{semidet}.

Here's another take on the documentation.  It may or may not be better
than the above :-)  [Well, except for fixing the `@var{Goal} @var{Goal}'
typos.]

	@item @code{promise_equivalent_solution @var{Vars} @var{Goal}} A
	determinism cast.  @var{Vars} must be a list of variables.
	@var{Goal} must be a valid goal.  This goal promises that
	@var{Vars} is the set of variables bound by @var{Goal}, and that
	while @var{Goal} may have more than one solution, all of these
	solutions are equivalent with respect to the equality theories
	of the variables in @var{Vars}.

	It is an error for @var{Vars} to include a variable not bound by
	@var{Goal} or for @var{Goal} to bind a non-local variable that
	is not listed in @var{Vars}.

	If @var{Goal} has determinism @samp{multi} or @samp{cc_multi} then
	@code{promise_equivalent_solution @var{Vars} @var{Goal}} has
	determinism @samp{det}.

	If @var{Goal} has determinism @samp{nondet} or @samp{cc_nondet} then
	@code{promise_equivalent_solution @var{Vars} @var{Goal}} has
	determinism @samp{semidet}.

Actually, my suggested documentation raises a point: why should Goal be
interpreted in a single solution context?  I can't see a problem with
Goal backtracking internally on the way to obtaining a solution.

-- Ralph
--------------------------------------------------------------------------
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