[m-rev.] for review: delete obsolete procedures from string module

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Apr 13 17:53:19 AEST 2022

2022-04-13 16:52 GMT+10:00 "Julien Fischer" <jfischer at opturion.com>:
> Redundant modes on clauses seems like the kind thing the
> compiler should warn about.

The attached diff tries to do that, but it does not bootstrap,
because it generates warnings for mode-specific clauses of
predicates that (a) have only one mode, but (b) also have foreign_procs.
A comment in add_clause.m leads me to believe that at one time,
we required all Mercury clauses to be mode-specific in predicates that also
had foreign_procs, but the code currently there makes that unnecessary
(it internally converts mode-agnostic clauses to mode-specific clauses,
though specific to *all* the predicate's clauses, which the HLDS supports
even though we have no syntax for it). I tested this, and deleting the modes
from Mercury clauses in such cases works.

I also cannot find any mention of such a requirement in the reference manual.
It may have been there and deleted, or it may never have been there at all.

So we need to choose a course of action.

One: make this new warning conditional on a new option, and disable this option
in modules where the new warning would cause compilation to fail through
--halt-at-warn. This would disable the warning in some of the modules where
we could benefit from it, such as string.m itself.

Two: delete the modes from clauses for predicates with foreign_procs.

Three: do not generate the warning for predicates that also have foreign_procs.
This cannot be done with the current architecture of make_hlds, because we add
all clauses before we add any foreign_procs.

Four: the status quo, with no new warning at all.

I prefer two. Opinions?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.rmsc
Type: application/octet-stream
Size: 3497 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20220413/a52080d9/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: S2ERRS
Type: application/octet-stream
Size: 3460 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20220413/a52080d9/attachment-0001.obj>

More information about the reviews mailing list