[m-dev.] diff: bug fix - impurity in .opt files

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Aug 25 17:58:58 AEST 1999


On 25-Aug-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> 
> compiler/intermod.m:
> 	Don't write the clauses for predicates which call impure predicates
> 	to `.opt' files. This avoids mode errors when mode checking
> 	the clauses from `.opt' files. The errors occur because the
> 	head unifications in clauses read from `.opt' files have been
> 	expanded twice - once when read from the `.m' file and again when
> 	read from the `.opt' file. Only the original head unifications may
> 	be reordered with impure goals. Fixing this in mode analysis would
> 	be tricky.

Did you consider fixing it by ensuring that head unifications get
compacted again when writing out clauses to the `.opt' files?
Hmm, I guess that would be tricky too.

> Index: compiler/intermod.m
...
> +		% Goals which call impure predicates cannot be written
> +		% due to limitations in mode analysis. The problem is that
> +		% only head unifications are allowed to be reordered with
> +		% impure goals.
> +		% 	
> +		% e.g
> +		%	p(A::in, B::in, C::out) :- impure foo(A, B, C).
> +		% becomes
> +		% 	p(HeadVar1, HeadVar2, HeadVar3) :-
> +		%		A = HeadVar1, B = HeadVar2, C = HeadVar3,
> +		% 		impure_goal(A, B, C).

I think you mean s/impure_goal/impure foo/

> +		% In the clauses written to `.opt' files, the head
> +		% unifications are already expanded, and are expanded
> +		% again when the `.opt' file is read in. The `C = HeadVar3'
> +		% unficiation cannot be reordered with the impure goal,
> +		% resulting in a mode error. Fixing this in mode analysis
> +		% would be tricky.

s/unficiation/unification/

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