Re: [m-users.] Is this a compiler bug?

Volker Wysk <[email protected]>
Newsgroups gmane.comp.lang.mercury.general
Message-ID <[email protected]>
Am Mittwoch, dem 16.11.2022 um 14:27 +1100 schrieb Julien Fischer:
> On Tue, 15 Nov 2022, Volker Wysk wrote:
> 
> > You talk about "reordering" of the clauses, which make up the two
> > superhomogenous forms. The second form, you say, could or could not be a
> > reordered version of the first. But the two superhomogenous forms can't be
> > reordered versions of each other, because the first one consists of three
> > clauses, whereas the second one consists of two clauses. I don't fully get
> > what you're saying.
> 
> What is being reordered are *goals* within a clause, not clauses
> themselves. (main/2 has only a single clause in both versions of the
> program.)

Sorry, my bad.

> > I'm wondering if there's some documentation about superhomogenous forms and
> > mode analysis. The word "superhomogenous" doesn't occur in the language
> > reference manual.
> 
> Superhomeogenous normal form (to give its full name) is described in
> many of the Mercury papers. It is the representation on which many of
> the passes in the compiler operate. (See for example, section 2.2 of
> "The execution algorithm of Mercuy: an efficient purely declarative
> logic programming language." by Somogyi, Henderson and Conway to name
> but one.)

I've downloaded that paper. Now I need to seriously study it.

> 
> ...
> 
> > The following version of main fails to compile (like expected) with
> > "Unification of `P1' and `P2' can fail". (Here we have the point of
> > failure). Even though that isn't the case:
> > 
> > main(!IO) :-
> >    P1 = A - B,
> >    p(P2, !IO),
> >    P1 = P2.
> > 
> > I suppose this due to what you described as "the fact that the current
> > Mercury implementation does not support partial instantiation properly". 
> 
> In this case, the explanation is: the compiler has to generate an
> out-of-line predicate to implement the unification of P1 and P2. That
> generated predicate is declared to be semidet, which is why you are
> getting the determinism error. The unification should to be det, since
> filling in the holes in P1 with the args from P2 will aways succeed.
> The fact that the compiler does not know that is one of the limitations
> I was referring to.

The question is, what does a mere user of the Mercury language need to know
in order to understand this, and what does he need to know in order to work
around it?

Cheers,
Volker

_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE6QXGh82Ov3+2nrxp+K4ydFOsHoUFAmN2cpUACgkQ+K4ydFOs
HoW19RAAqnluC3E3O3/AdVZwdlQmTwUiP76SbQd6+svhupTVDo5oxZlTHTmusInx
uNYnRzRQ9F4iqhhgLJf1WTYVtHtFk0zMXqJw8yFvELhbD6InmJGfec4U6tBJcNdu
v1LwmwrRgwX9hSmRNiM5Maw9bzCbm6GUviHgdwoxgOUffxrr7rykA63bqKB19bk+
usd3FvdSqvqplS3LzrqkdNPNWUAa0AaBC1uDsGQjddbZN5HDUPfcQbyWlvcqvnK9
Z0HEiVWdDom5zQpNGTAGhC0uv9dQZuAnRN6PZP0x+81Grlqt0TSqOYwGo7JRFxHF
pLc5rczGeVE+SWZxWeUPcNQFSPpsWZzSTjMK5WEC4gE8aEAVIHCaWG3IhbhppcGe
UNAsF5f6Hqqzw6GvDsaWtu4Um+nKdrnBIeHj0n20SJrZbbWgoxtm7UliqKrk7Eo1
9Ys1DSguk8RfMtxo48fIJ7NL6WYLw0/yxztFsF74hHYdHcdvzbPYvqit41PZ/UR7
fno8FvjC6CtBYbG7mo+QDLa3PAslLzhSEngnbyfxqEVtzLj/Vd4o5rtlu0ISFIMS
Z/QcVzQKEXSoXyd6XVc/HlZkoEP+kuZXAk9wqIQ6plG3HaOkx/WKogpJ6+lhJ7Le
+0u2YhRTgUg9MSegHoAvrbgKVXtI4MGpj3DpY5xGRdqRsbDBfTU=
=dxh4
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.