[mercury-users] New to mercury: structure reuse and efficiency

Ralph Becket rafe at cs.mu.OZ.AU
Tue Jul 6 08:53:00 AEST 2004

Nicholas Nethercote, Monday,  5 July 2004:
> Whoa, that little paragraph raises a whole lot of interesting questions, 
> things like:
>   What do the modes look like?

A new inst, `any', is introduced.  `any' differs from `ground' in the
following sense:
- the set of values that unify with an inst `ground' variable must form
  an equivalence class;
- the set of values that unify with an inst `any' variable may not form
  an equivalence class.
Less formally, a `ground' variable is "fixed", whereas an `any' variable
may not be (rather like a Prolog value can contain zero or more unbound

So code using "Prolog types" (and other constrained types) will use
modes `in(any)' and `out(any)' for these values.

We also have machinery to handle `ground' values of these types, but I
won't go into that here.

>   What's the term representation used?

That all depends upon how each particular constrained type is
implemented.  For "Prolog types", bound terms will be represented as
ordinary Mercury data constructors, variable terms will be represented
using a WAM- or PARMA-style scheme.

>   How much of this is replicates what's in HAL?

I'm being paid by the HAL project!  The intention is to migrate the HAL
work to Mercury so we only have one language to maintain.  This should
all happen in the very near future (hopefully within days), at least on
the development branch of the compiler.

> etc.  It sounds like a major language extension.  Or not, depending on a 
> multitude of things.  Do you have anything describing this in detail?

As soon as I sniff out the last buglet I'm going to start work on the
paper.  There will also be documentation in the Reference Manual, but
that will probably not be tutorial in nature.

-- Ralph
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe

More information about the users mailing list