[m-dev.] Re: [HAL-dev] Adding Herbrand types to Mercury

Ralph Becket rafe at cs.mu.OZ.AU
Tue Jan 27 12:38:49 AEDT 2004


Fergus Henderson, Tuesday, 27 January 2004:
> On 23-Jan-2004, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> > (1) Solver types in Mercury
> 
> I don't agree that solver implemenations must inevitably involve
> impure coding.  But this is not important for your proposal.

Point taken, I meant to suggest I imagine the majority of them will.

> Sounds fine.
> 
> > TODO:
> > - Support the new syntax. 
> > - Record the <initpred> and <unifypred> info somewhere in the HLDS. 
> > - Get mode analysis to schedule calls to <initpred> and <unifypred>. 
> > - I think that's it.
> 
> At some point the compiler needs to check that <initpred> and
> <unifypred> have the right type, mode, and determinism.

Good point - added to the TODO list.

> > (2) Herbrand types in Mercury
> 
> I think it would be nice if we could come up with a less jargonish
> term than "Herbrand".

s/"Herbrand"/"Prolog"/?



> 
> > Scheduling of the Herbrand unification X = f(Y, ...) (for some data
> > constructor f) works as follows:
> > 
> > inst(X) | inst(Y, ...) | scheduled goals
> > --------+--------------+----------------
> > free    | some or all  |init_Herbrand(V), ...,   [for each free V in Y, ...]
> >         | free         | construct X = f(Y, ...)
> > --------+--------------+----------------
> > any     | some or all  | init_Herbrand(V), ...,   [for each free V in Y, ...]
> >         | free         | construct Z = f(Y, ...)  [for some new variable Z  ]
> >         |              | unify(X, Z)
> 
> This will lead to poor performance.  In the case of X = f(Y, ...)
> where X has static inst "any", but is bound at run-time, we should not
> need to allocate any heap space.

Sure.  But version 1.0 can take the easy route.  Version 1.1 can include
optimisation tweaks.

-- Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list