mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
Estimated hours taken: 0.5 Update a few files in preparation for release 0.8. NEWS: Put the main sections in reverse chronological order, i.e. 0.8, then 0.7.3, then 0.7.2, rather than 0.7.2, 0.7.3, then 0.8. This is better since the changes in 0.7.2 and 0.7.3 are old news. Also a few minor changes, such as deleting the XXX about `pragma import' and nondet `pragma c_code' not being documented. RELEASE_NOTES: Update for 0.8. configure.in: Update the test for recently-added features to test for `promise_only_solution'. That should be recent enough to ensure that we can bootstrap.
208 lines
8.8 KiB
Plaintext
208 lines
8.8 KiB
Plaintext
|
|
We are pleased to announce the release of version 0.8 of the Mercury system.
|
|
|
|
Mercury is a new general-purpose programming language, designed and
|
|
implemented by a small group of researchers at the University of
|
|
Melbourne, Australia. Mercury is based on the paradigm of purely
|
|
declarative programming, and was designed to be useful for the
|
|
development of large and robust ``real-world'' applications.
|
|
It improves on existing logic programming languages by providing
|
|
increased productivity, reliability and efficiency, and by avoiding the
|
|
need for non-logical program constructs. Mercury provides the
|
|
traditional logic programming syntax, but also allows the
|
|
syntactic convenience of user-defined functions, smoothly integrating
|
|
logic and functional programming into a single paradigm.
|
|
|
|
For a list of what's new in this release, see the NEWS file.
|
|
|
|
The main features of Mercury are:
|
|
|
|
o Mercury is purely declarative: predicates and functions
|
|
in Mercury do not have non-logical side effects.
|
|
|
|
Mercury does I/O through built-in and library predicates that
|
|
take an old state of the world and some other parameters, and
|
|
return a new state of the world and possibly some other
|
|
results. The language requires that the input argument
|
|
representing the old state of the world be the last reference
|
|
to the old state of the world, thus allowing it the state of
|
|
the world to be updated destructively. The language also
|
|
requires that I/O take place only in parts of the program where
|
|
backtracking will not be needed.
|
|
|
|
Mercury handles dynamic data structures not through Prolog's
|
|
assert/retract but by providing several abstract data types in
|
|
the standard Mercury library that manage collections of items
|
|
with different operations and tradeoffs. Being a compiled
|
|
language, Mercury does not have any means for altering the
|
|
program at runtime, although we may later provide facilities
|
|
for adding code to a running program.
|
|
|
|
o Mercury is a strongly typed language. Mercury's type system is
|
|
based on many-sorted logic with parametric polymorphism, very
|
|
similar to the type systems of modern functional languages such
|
|
as ML and Haskell. Programmers must declare the types they
|
|
need using declarations such as
|
|
|
|
:- type list(T) ---> [] ; [T | list(T)].
|
|
:- type maybe(T) ---> yes(T) ; no.
|
|
|
|
They must also declare the type signatures of the predicates and
|
|
functions they define, for example
|
|
|
|
:- pred append(list(T), list(T), list(T)).
|
|
|
|
The compiler infers the types of all variables in the program.
|
|
Type errors are reported at compile time.
|
|
|
|
o Mercury is a strongly moded language. The programmer must
|
|
declare the instantiation state of the arguments of predicates
|
|
at the time of the call to the predicate and at the time of the
|
|
success of the predicate. Currently only a subset of the
|
|
intended mode system is implemented. This subset effectively
|
|
requires arguments to be either fully input (ground at the time
|
|
of call and at the time of success) or fully output (free at
|
|
the time of call and ground at the time of success).
|
|
|
|
A predicate may be usable in more than one mode. For example,
|
|
append is usually used in at least these two modes:
|
|
|
|
:- mode append(in, in, out).
|
|
:- mode append(out, out, in).
|
|
|
|
If a predicate has only one mode, the mode information can be
|
|
given in the predicate declaration.
|
|
|
|
:- pred factorial(int::in, int::out).
|
|
|
|
The compiler will infer the mode of each call, unification and
|
|
other builtin in the program. It will reorder the bodies of
|
|
clauses as necessary to find a left to right execution order;
|
|
if it cannot do so, it rejects the program. Like type-checking,
|
|
this means that a large class of errors are detected at
|
|
compile time.
|
|
|
|
o Mercury has a strong determinism system. For each mode of each
|
|
predicate, the programmer should declare whether the predicate
|
|
will succeed exactly once (det), at most once (semidet), at
|
|
least once (multi) or an arbitrary number of times (nondet).
|
|
These declarations are attached to mode declarations like
|
|
this:
|
|
|
|
:- mode append(in, in, out) is det.
|
|
:- mode append(out, out, in) is multi.
|
|
|
|
:- pred factorial(int::in, int::out) is det.
|
|
|
|
The compiler will try to prove the programmer's determinism
|
|
declaration using a simple, predictable set of rules that seems
|
|
sufficient in practice (the problem in general is undecidable).
|
|
If it cannot do so, it rejects the program.
|
|
|
|
As with types and modes, determinism checking catches many
|
|
program errors at compile time. It is particularly useful if
|
|
some deterministic (det) predicates each have a clause for each
|
|
function symbol in the type of one of their input arguments,
|
|
and this type changes; you will get determinism errors for all
|
|
of these predicates, telling you to put in code to cover the
|
|
case when the input argument is bound to the newly added
|
|
function symbol.
|
|
|
|
o Mercury has a module system. Programs consist of one or more
|
|
modules. Each module has an interface section that contains
|
|
the declarations for the types, functions and predicates
|
|
exported from the module, and an implementation section that
|
|
contains the definitions of the exported entities and also
|
|
definitions for types and predicates that are local to the
|
|
module. A type whose name is exported but whose definition is
|
|
not, can be manipulated only by predicates in the defining
|
|
module; this is how Mercury implements abstract data types.
|
|
For predicates and functions that are not exported, Mercury
|
|
supports automatic type, mode, and determinism inference.
|
|
|
|
o Mercury supports higher-order programming,
|
|
with closures, currying, and lambda expressions.
|
|
|
|
o Mercury is very efficient (in comparison with existing logic
|
|
programming languages). Strong types, modes, and determinism
|
|
provide the compiler with the information it needs to generate
|
|
very efficient code.
|
|
|
|
The Mercury compiler is written in Mercury itself. It was bootstrapped
|
|
using NU-Prolog and SICStus Prolog. This was possible because after
|
|
stripping away the declarations of a Mercury program, the syntax of the
|
|
remaining part of the program is mostly compatible with Prolog syntax.
|
|
|
|
The Mercury compiler compiles Mercury programs to C, which it uses as a
|
|
portable assembler. The system can exploit some GNU C extensions to the
|
|
C language, if they are available: the ability to declare global
|
|
register variables, the ability to take the addresses of labels, and
|
|
the ability to use inline assembler. Using these extensions, it
|
|
generates code that is significantly better than all previous Prolog
|
|
systems known to us. However, the system does not need these
|
|
extensions, and will work in their absence.
|
|
|
|
The current Mercury system has been tested extensively on Solaris 2.x,
|
|
IRIX 5.x, OSF/1.1, and Linux, and is also known to run on Ultrix 4.3,
|
|
BSDI 1.1, AIX, and HPUX; it should run without too many changes on
|
|
other Unix variants as well. It also runs on Windows 95 and Windows
|
|
NT, using the Cygwin library. If you do encounter any problems,
|
|
please report them to <mercury-bugs@cs.mu.oz.au> (see the BUGS file).
|
|
|
|
The current source distribution uses gcc as the compiler. We require gcc
|
|
version 2.6.3 or higher. You will also need GNU make version 3.69 or higher.
|
|
|
|
The Mercury distribution contains:
|
|
|
|
o an autoconfiguration script
|
|
o the Mercury source for the compiler
|
|
o the Mercury source for the standard library
|
|
o the automatically generated C source for the compiler
|
|
and the standard library
|
|
o the runtime system (written in C)
|
|
o Hans Boehm's conservative garbage collector for C
|
|
o a debugger
|
|
o a profiler
|
|
o some utility programs, including a make front-end for Mercury
|
|
with automatic dependency recomputation
|
|
o the Mercury language reference manual
|
|
o the Mercury library reference manual
|
|
o the Mercury user's guide
|
|
o the Mercury frequently asked questions list
|
|
o the Prolog to Mercury transition guide
|
|
o some sample Mercury programs
|
|
o some extra libraries for
|
|
- processing HTML forms using the CGI interface
|
|
- arithmetic on complex and imaginary numbers
|
|
- graphics using Tk and OpenGL
|
|
- exception handling
|
|
- backtrackable (trailed) destructive update
|
|
- an ODBC database interface
|
|
- a CLP(R) interface, i.e. constraint solving over real numbers
|
|
o a test suite
|
|
|
|
The Mercury distribution is available via anonymous ftp or WWW
|
|
from the following locations:
|
|
|
|
Australia:
|
|
ftp://turiel.cs.mu.oz.au/pub/mercury
|
|
|
|
We hope to be able to make it available at the following sites
|
|
too, eventually:
|
|
|
|
Sunsite and mirrors: (source distribution only)
|
|
ftp://sunsite.unc.edu/pub/Linux/Incoming
|
|
ftp://sunsite.unc.edu/pub/linux/devel/lang/mercury
|
|
|
|
USA:
|
|
ftp://ftp.cs.sunysb.edu/pub/XSB/mercury
|
|
|
|
Europe:
|
|
ftp://ftp.csd.uu.se/pub/Mercury
|
|
|
|
The home page of the project on the Web is <http://www.cs.mu.oz.au/mercury>.
|
|
|
|
--
|
|
The Mercury Team <http://www.cs.mu.oz.au/mercury/people.html>
|
|
Department of Computer Science, The University of Melbourne, Australia
|