[m-dev.] trivial diff: define `int:is/2' in Mercury

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Mar 23 09:12:48 AEDT 1999


On 23-Mar-1999, Peter Schachte <schachte at cs.mu.OZ.AU> wrote:
> On Mon, Mar 22, 1999 at 10:50:08PM +1100, Fergus Henderson wrote:
> > Ideally it ought to be defined in prolog.m rather than int.m.
> > But unfortunately there isn't any simple way of moving a predicate
> > from one module to another module in a backwards-compatible way;
> > `pragma obsolete' isn't quite enough in this case.
> 
> In this case, I'd think you could just move it.  It's unlikely people
> are explicitly module qualifying calls to this predicate.  The only
> problem would be for people who don't already use prolog.m, for them,
> is/2 would just disappear, and they'd have to read the NEWS file to
> understand why.  Is that the problem?

The problem is that they should just get a warning rather than an
error.  Only after the compiler has been warning them for several
releases should we make it an error.

A potential work-around for that problem would be adding
it to prolog.m without removing it from int.m.
But then users would get ambiguity errors if they include
both modules, unless they explicitly module-qualify their
calls to `is', so that work-around doesn't work.

> Ok, `pragma obsolete' isn't right; you could add a `pragma moved', but
> maybe it would be better to generalize it to something like
> 
> 	:- pragma use_warning is/2 = 
> 		"This predicate has moved to the `prolog' module.".

I would prefer just allowing an extra argument to `pragma obsolete',
i.e.

	:- pragma obsolete(<Predicate>, <Reason>).

For example

	:- pragma obsolete(is/2, 
 		"This predicate has moved to the `prolog' module.").

However, this still wouldn't solve the problem with is/2.

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