[m-dev.] for review: allow separate mode decls for zero arity preds

Simon Taylor stayl at cs.mu.OZ.AU
Mon Sep 6 11:09:49 AEST 1999


> Estimated hours taken: 0.75
> 
> compiler/make_hlds.m:
> 	Don't add a default mode for predicates with zero arity
> 	and no pred or mode declaration.  The rationale is that
> 	there's no compelling reason to add a default mode, since
> 	the mode will be inferred anyway, if it is used,
> 	and adding a default mode breaks some existing code,
> 	e.g. extras/clpr/samples/tests.m, which assumes that
> 	a predicate that is not called and which has zero arity and
> 	no pred or mode declaration need not be mode-correct.
 
I don't think this is a good assumption for that code to be making. If
there is only one mode which can be inferred I don't see any good reason
not to infer it and do full error checking even if the code is not used.
There's no point adding the code if it isn't going to be used sometime.
I'd prefer to have the error reported when I've just written the code rather 
than sometime later when a call to it is added.

I think we'll have to agree to disagree on this one. If you do commit
this change, you'll have to undo my change to the expected output of
tests/invalid/bigtest.m.

Simon.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list