[m-rev.] State variable syntax transformation

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Feb 26 17:03:27 AEDT 2002


On 26-Feb-2002, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> By the way, somewhere in the Mercury manual (I recall) it says something
> to the effect that (if _ then _) is equivalent to (if _ then _ else
> true), but this is actually only the case for DCG code.

I think you recall wrongly -- both about the existence of the wording
and about the behaviour of this construct in DCGs.

If you think there is some wording in the Mercury manual
which is misleading or incorrect, please be more specific.

> It seems to me
> that it would be useful to extend the syntax to ordinary code, too,
> mainly for error handling - e.g.
> 
> 	( if we_have_a_problem(X) then throw_an_exception(X) )

Code like this should be avoided, since it will get entirely optimized away
if you compile with `--no-fully-strict'.

Furthermore extending the syntax in this way would be confusing for
Prolog programmers, because of Prolog's opposite semantics for
if-then without else.

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