[m-rev.] for review: Correct status of partial instantiation support

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Mar 12 19:53:33 AEDT 2014



On Wed, 12 Mar 2014 14:49:59 +1100 (EST), Julien Fischer <jfischer at opturion.com> wrote:
> I suspect that specific code only "works" in those grades more by luck
> than design.  In general, it does not work.

That is correct, but I think Paul needs to know *why*.

The real reason why partially instantiated data structures do not work in general
is the lack of alias tracking in the mode system.

If you unify a variable and an argument of a term, then when either the variable
or the argument is bound, the other should be bound to the same thing. In the
absence of alias tracking, this won't happen. The only situation in which this
is ok is if "the other" does not exist anymore, which the current compiler
can be sure about only if its scope is restricted to the unification.

Even for code in which a free variable's scope is confined to its unification
with a free variable in a term, the code generators are not guaranteed to handle
the resulting partially instantiated terms correctly, simply because they
weren't *designed* to. Mantis bug 311 shows this very clearly. Though
I can imagine the different backends misbehaving differently on such code.
Some may even generate correct code by accident :-)

Zoltan.




More information about the reviews mailing list