[m-rev.] for review: don't allow nondefault mode functions in terms

Peter Wang novalazy at gmail.com
Sun Nov 1 11:15:06 AEDT 2015


On Sat, 31 Oct 2015 20:33:36 +1100, Mark Brown <mark at mercurylang.org> wrote:
> 
> I'll only accept that if the bug really is too hard to fix otherwise.
> 
> But my take on it is that non-default func insts should not be
> considered ground, for the purposes of inst_is_ground in inst_match.m.
> This is consistent with the definitions of inst_match_{initial,final}
> when the second argument is ground(_, none).

Isn't it strange if an instantiatedness tree `I' has all nodes bound
but I \=< ground?

Another solution to the problem is to verify at runtime that a
higher-order function has a default mode before calling it, otherwise
throwing an exception.  It seems quite fitting as the original change
introduced unsoundness.  We would need to add an extra bit of
information to indicate whether a higher-order term has a default or
non-default mode.

Peter



More information about the reviews mailing list