[mercury-users] Redefinition of logical operations

Ralph Becket rafe at csse.unimelb.edu.au
Thu Aug 20 11:11:02 AEST 2009


Hi Dmitry,

Dmitry Negius, Wednesday, 19 August 2009:
>    I study Mercury language now wich I consider as trusted Prolog. In the
>    prolog it is possible to introduce own operations with given
>    priorities. I have a question: Is it possible in the Mercury language
>    to define own logical operations: and, or, xor, <=>, <=, =>? Seems "or"
>    frequantly used in the Mercury programs instead of "xor" wich can
>    result in the program failures. It is more beautifully to write "and"
>    instead of "," and "or" instead of ";".

We decided against supporting user-defined syntax because we couldn't
see a good way of integrating it with separate compilation.

If you're suggesting we allow "and" instead of ",", and so forth, then
we consider that to be a Very Bad Idea because having multiple symbols
mean the same thing will make programs harder to read.

Mercury certainly allows overloading of function symbols and data
constructors, however (although this should be done with care).  See,
for example, the bool module in the standard library.

-- Ralph
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list