diff: fix instance decls in .int files

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Mar 3 00:43:20 AEDT 1998


On 02-Mar-1998, David Glen JEFFERY <dgj at cs.mu.OZ.AU> wrote:
> Fix a bug introduced by Fergus' recent changes to mercury_to_mercury.m: the
> instance declarations output into the .int files were not syntactically valid.
>
> compiler/mercury_to_mercury:
> 	Put an extra set of brackets around the predname in the pred/arity so
> 	that the compiler isn't fooled by the precedences of ":" and "/".

That looks fine, but I think it would be a good idea to add a comment to
the source code, explaining why the extra parentheses are necessary.

Actually when I think about it a bit more, the same problem
is likely to confuse users, both for instance declarations
and for other situations involving module qualifiers and
operators such as `/'.  For example, I would like to be able to write

	m1:quotient = m2:numerator / m3:divisor.

without having to insert any parentheses.

So a better fix would be to change the precedence of the module
qualifier (currently ":") to something that binds tighter
(i.e. that is numerically lower) than any other operator.

-- 
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.



More information about the developers mailing list