[m-dev.] Moving quantification
Fergus Henderson
fjh at cs.mu.OZ.AU
Sat Feb 19 21:59:46 AEDT 2000
On 18-Feb-2000, Peter Nicholas MALKIN <pnmalk at students.cs.mu.oz.au> wrote:
> Quantification (in particular the predicate implicitly_quantify_clause_body/8)
> is first done from within make_hlds.m, at the end of the predicate transform/18
> (this predicate converts an item clause to an hlds_goal clause).
>
> This proves a problem for me if I perform the EDCG transformation, which
> introduces new variables, immediately after typecheck. Thus I would like to
> perform quantification after typecheck, after I perform the EDCG transformation
> (this will also mean moving warning for singletons after typecheck too because
> it uses the information from quantification).
>
> Can anyone see any problems (either caused now or in the future) with doing
> this?
Yes! It is essential to do quantification before type checking.
Type checking assumes that every occurrence of a variable must
have the same type. If you don't do quantification analysis
first, then type checking would assume that different variables
that happen to have the same name must have the same type.
However, it would be OK to do quantification analysis before doing
typechecking and to redo it after performing the EDCG transformation.
It would be better (more efficient) if you could avoid this, by
computing the proper nonlocals for each goal as you perform the
EDCG transformation, but if that is difficult, then it would be OK
to redo quantification analysis (though preferably only for those
goals that contain EDCG constructs).
--
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