[mercury-users] failure warning

Peter Moulder Peter.Moulder at infotech.monash.edu.au
Thu Aug 21 14:12:05 AEST 2003


On Thu, Aug 14, 2003 at 09:49:21AM +1000, Peter Schachte wrote:
> > foo(X, Y) :-
> >     ( if ... then
> >         Y = ...
> >     else
> >         false
> >     ).
> 
> I'm just curious why you don't more succinctly write
> 
> foo(X, Y) :-
>         ...,
>         Y = ... .

An example is in the recent change to array.m, where the operational
semantics were important (mustn't try to evaluate `Y = ...' unless
the condition succeeded).

In fact in the first version of the patch I did write `false' instead of
`fail': I think it better to encourage people to think logically with
`false' than imperatively with `fail'.  I think `false' should become a
builtin synonymous with `fail'.

pjm.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list