[m-dev.] Re: "bug/feature" in mercury any

Warwick Harvey wharvey at cs.monash.edu.au
Wed Jan 13 15:38:56 AEDT 1999


Fergus wrote:
> On 21-Dec-1998, Peter Stuckey <pjs at cs.mu.OZ.AU> wrote:
> > We need to be able to convert an any inst to a ground inst
> > and it doesnt seem like Mercury will allow this. (It should,
> > it can be quite logical)
> > 
> > Heres an example of the problem, when we try to write
> > 	promise_ground
> > 
> > Can this be fixed!
> 
> The problem here is one that should hopefully be solved by alias tracking.
> 
> The reason that the problem occurs is that the compiler transforms your code
> 
> 	bar(X) :-
> 		promise_foo_ground(X).
> 
> to
> 
> 	bar(HeadVar__1) :-
> 		HeadVar__1 = X,
> 		promise_foo_ground(X).
> 
> before mode analysis.  Mode analysis correctly infers that `X' is ground,
> but because the current version doesn't do any alias tracking, it fails
> to infer that this implies that `HeadVar__1' is ground.

It's now much clearer to me why it doesn't work, thanks.

So, can anybody (Andrew?) say for sure whether this will be solved by alias 
tracking?  And how far off is the alias tracking code?

We can work around the problem by program transformation (introduce a new 
variable every time a variable has an `any' [sub]inst replaced some 
something more specific), but obviously we would rather avoid doing this 
work if a better solution (i.e. alias tracking) will be available by the 
time we need it.

Thanks,
Warwick




More information about the developers mailing list