[mercury-users] Learning Mercury

Ralph Becket rafe at csse.unimelb.edu.au
Mon Aug 13 14:30:33 AEST 2007


Tom Davies, Monday, 13 August 2007:
> Why does Mercury need the 'horizontal' predicate to generate the  
> possible values for P2? Prolog (as I understand it) would carry  
> uninstantiated values for P2 down its search tree until it can unify  
> them.

Mercury doesn't support free variable aliasing the way Prolog does (at
least, it doesn't unless you use a solver type, which is getting into
more advanced territory).  The reasons for this include:
- the substantial associated performance cost, which you pay regardless
  of whether you use it or not (and very few programs actually use it);
- the difficulty of generating mode-specific code when non-ground values
  are allowed;
- the difficulty in ensuring the soundness of code with non-ground
  values (e.g., bad things can happen inside negations).

If you really have to use constrained values (e.g., supporting
equality/disequality constraints) you need to use solver types.  I'm
only going to talk about them if you force me!

-- Ralph
--------------------------------------------------------------------------
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