[m-rev.] for review: rewrite of Modes chapter
David Overton
dmo at cs.mu.OZ.AU
Fri Feb 21 16:30:14 AEDT 2003
On Fri, Feb 21, 2003 at 10:45:07AM +1100, Fergus Henderson wrote:
>
> > +A higher-order inst @var{A} is at least as instantiated as inst @var{B} iff
> > + at var{A} is identical to @var{B}.
> > +Higher-order terms are considered ground,
> > +and there is no way for them to become more ground.
>
> I think this is wrong. The "is at least as instantiated as" ordering
> should be the same as the "matches" ordering for higher-order insts.
>
> The compiler is currently still broken regarding this; see
> <http://www.cs.mu.oz.au/research/mercury/mailing-lists/mercury-reviews/
> mercury-reviews.0211/0325.html>.
That email refers to the "matches" ordering. There are two variants of
that ordering in the compiler -- inst_matches_initial (which allows
calls to implied modes) and inst_matches_final (which does not allow
calls to implied modes). The implementation of inst_matches_initial is
currently too convervative. The implementation of inst_matches_final is
correct.
The instantiatedness ordering only manifests itself in the compiler in
the form of `abstractly_unify_inst' which basically takes the greatest
lower bound of two insts with respect to this ordering. However, since
we are not allowed to unify two variables with higher-order insts anyway
(the unification would be undecidable), the compiler doesn't really need
to care what the instantiatedness partial order says about comparing them
(except if we are doing a `fake_unify', which _is_ broken in the
compiler -- it just returns the inst of the first variable as the result
of the unification -- however the comment at that code says that this
should not matter for fake unifications).
However, Fergus is right that Marks change to the manual here is wrong
-- it makes the language overly conservative.
>
> Also, it should say somewhere that higher-order terms are at least
> as instantiated as "ground", but "ground" is not as instantiated
> as any higher-order term.
>
> Likewise, there should be a description of when "ground" is considered
> at least as instantiated as a subtype inst and vice versa.
Also, the same is required for "matches".
David
--
David Overton Uni of Melbourne +61 3 8344 1354
dmo at cs.mu.oz.au Monash Uni (Clayton) +61 3 9905 5779
http://www.cs.mu.oz.au/~dmo Mobile Phone +61 4 0337 4393
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list