[m-users.] What's special about Mercury?

Mark Brown mark at mercurylang.org
Tue Jun 25 20:04:26 AEST 2019


Hi Julian,

On Fri, Jun 21, 2019 at 11:48 AM <jfondren at minimaltype.com> wrote:
> ** What's special about Mercury?

The language design is optimised for reasoning about programs.

I need to reason about programs
- when I'm coming up with a suitable architecture for some new code,
- when I'm working out how to make the design into an implementation,
- when I have to explain the inevitable bugs in my code,
- when my code runs too slowly,
- when I have to understand someone else's code,
- when I have to understand code written by a series of people, who
may have had different understandings of what the program is even
supposed to do, etc.
For myself (and the projects I work on), reasoning about programs in
one way or another is where I spend most of my time. So it makes sense
that that's what I want to optimise.

As an example, one kind of reasoning I can easily do in Mercury is
look at a predicate of, say, 50 lines, and quickly work out a "slice"
of the code that leads up to a particular variable getting its value.
If I'm investigating a bug where that variable has the wrong value, or
if I'm trying to figure out the exact meaning of the variable, I only
need to look at the slice, which may be only a handful of lines
instead of the full 50. That saves me a lot of effort.

And I don't mean that it saved me some effort once recently. I mean it
saves me a lot of effort almost every working day.

> What can you do with Mercury?

In a way it's what you can't do that matters. You can't assert or
retract things from the database; you can't use general cut; you can't
use side effects. It's because you can't do these things that you
*can* reason about Mercury programs so effectively.

My 2ยข.

Mark


More information about the users mailing list