Subject: Re: Mercury???

From: "Richard A. O'Keefe" <[email-masked]>
Date: Tue, 14 Mar 2000 13:41:59 +1300 (NZDT)

[email-masked] wrote
	I have found a language called "Mercury".
	They said that this is (more) powerful than Prolog,
	and it is faster than Prolog.
	I wish you (would) tell me your thoughts about it.

Mercury is a pure logic programming language whose syntax is extremely
close to Prolog's (indeed, until they had the Mercury compiler fully
operational, the Mercury compiler was compiled by the NU Prolog compiler).
It adds Mycroft/O'Keefe types (including higher-order types) and also
strong mode declarations.  There is also a sublanguage with functional
syntax, so you can treat it as a functional programming language if you
wish.  There is a growing library, including GUI interface and a CORBA
interface.  The documentation could be better, but then, so could SWI
Prolog's.  The module system is reasonable.

Zoltan Somogyi, who invented it, wanted a logic programming language
that could be offered to a software engineer with a straight face.
The type and mode system do have the effect of letting the compiler
generate very efficient code (e.g. toy programs running faster than
normal C, and realistic programs running within a factor of 2 of C),
but they are mainly there to let the compiler detect errors.

When you offer Mercury to a software engineer, you are not lying about
the "good quality code" or the "readability" or the "compile time error
detection" or any of those things.  You are ALSO not lying about
"100% pure declarative logic programming".  The Mercury I/O model is
that a program is a relation between the initial state of the world and
the final state of the world, although this is largely hidden by the use
of DCG notation.  (It's rather like Clean.  Like Clean, the semantics
gets rather subtle when you allow other processes to execute at the same
time, but the model does still work.)

The method chosen to permit declarative I/O also permits (as in Clean)
constant-time updatable arrays and some compile-time garbage collection.

However, there are some things that Prolog can do easily that Mercury
can't, such as modifying the database and other "reflective" stuff.

People who like typeful languages will find Mercury the logic programming
language they've been waiting for.