[mercury-users] support for Prolog variables

Peter Schachte pets at cs.mu.OZ.AU
Tue Sep 8 11:43:55 AEST 1998


On Tue, Sep 08, 1998 at 05:06:43AM +1000, Fergus Henderson wrote:

> Prolog-style variables aren't very useful most of the time.
> They can make programs harder to understand, they make static
> checking difficult, and they can be very costly efficiency-wise.
> So we certainly don't want them to be the default.
> 
> However, occaisionally you do want to do some constraint solving on
> Herbrand terms.  We do want to have a solution for those relatively
> rare occaisions, and that is what the `var' module is for.

I don't want to pick nits, and this is a philosophical issue, but I
find it interesting that you look at this issue this way.  To me,
you're always doing constraint solving on Herbrand terms (or other
data structures).  Most of these constraints can be solved in a
straightforward linear sort of way, but some can't.  Currently,
Mercury can handle the former sort (modulo aliasing problems), but not
the latter.  The var module and any inst are a way to handle the
latter sort, but unfortunately this solution requires using different
types.  The nicer solution (to my tastes) would be to allow both sorts
of constraints over the same types (though not necessarily the same
representations), using the most efficient method in each case.  This,
I believe, is what HAL is trying to do.

-- 
Peter Schachte                | I like pigs. Dogs look up to us. Cats look
mailto:pets at cs.mu.OZ.AU       | down on us. Pigs treat us as equals.
http://www.cs.mu.oz.au/~pets/ |     -- Winston Churchill 
PGP: finger pets at 128.250.37.3 | 



More information about the users mailing list