[mercury-users] Error detection rate in Mercury vs Other Languages (esp C++ and Python)

Chris King colanderman at gmail.com
Mon Dec 5 15:57:11 AEDT 2011

On Sun, Dec 4, 2011 at 9:52 PM, Paul Bone <pbone at csse.unimelb.edu.au> wrote:
> I also avoid nondeterminism and failure.  Mercury has a desireable conbination
> of features:  purity, strong typechecking, switch completeness checking (a
> subset of determinism checking) and eager evaluation.

See, I came to Mercury from a language with all of those features --
OCaml.  In fact, OCaml is arguably better at typechecking: its
typesystem is strictly more expressive (subtyping) and has more
complete inference.  There are a couple other features (beside
nondeterminism and failure) which Mercury has but OCaml doesn't (e.g.
parallel conjunctions, function overloading, unique types) but none
compelling enough that I'd have switched to Mercury were
nondeterminism and failure *not* available.

But my code in OCaml is *far* larger and messier because I'm forced to
use lists or sets to represent nondeterminism.  Once I need to nest
any "nondeterministic" functions more than 1 level deep, I find myself
reinventing monads and Haskell's do-notation.

Furthermore, I find myself writing multiple functions where in
Mercury, I can replace these with one with multiple defined modes.
Every less function I write is one fewer I need to check for errors.

> The tools of Mercury are also very compelling, in particular the declarative
> debugger and the deep profiler.

I agree in that respect (though I haven't personally used either).

> I dislike the syntax, especially wrt pred, mode and instantiation state
> declrations.

I've grown to like writing mode declarations -- at least in the
context of reversible code -- because each one I write means one fewer
function I had to write :)  (Though I agree complex insts are verbose,
I don't have a better syntax either.)

- Chris

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