[m-dev.] for review: impure functions

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Apr 13 20:17:09 AEST 2000


On 13-Apr-2000, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> On 12-Apr-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > > One outstanding open issue is that we don't specify what happens
> > > when you put an impure call such as
> > > 		
> > > 		impure some_pred(foo(42), bar(17))
> > > 
> > > Where do the extra unifications get scheduled?
> > 
> > I think the unifications should get scheduled before
> > the call to the impure procedure.  This is in accordance
> > with the general principle that in the strict sequential
> > semantics such unifications get executed depth-first,
> > and that other semantics are based on the strict sequential
> > semantics with additional reordering allowed but not over
> > impure goals.
> 
> Does the strict semantics option really order unifications like this?
> The code looked like it always did unifications in the reverse order.

Yes.  This is an area where the current compiler does not conform to
the language specification, i.e. a bug.  Hopefully it will get fixed
someday.  The fix is unfortunately not trivial -- it requires changing
type analysis to use Peter Stuckey's algorithm to avoid encountering
the exponential worst case when compiling cases that involve lots of
overloading, e.g.  compiler/options.m.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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