[m-rev.] for review: tweak and announce the new options

Julien Fischer jfischer at opturion.com
Mon May 19 19:06:49 AEST 2025


On Mon, 19 May 2025 at 16:42, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:

> Tweak and announce the unneeded statevar options.

...

> diff --git a/NEWS.md b/NEWS.md
> index ba8bc5936..49b487f86 100644
> --- a/NEWS.md
> +++ b/NEWS.md
> @@ -1524,6 +1524,26 @@ Changes to the Mercury compiler
>    from having to decide on a case-by-case basis exactly where they want
>    to add a new `import_module` or `use_module` declaration.
>
> +* We have added two new options, --warn-unneeded-initial-statevars,

Mark up command line options in the NEWS file as inline code, so
`--warn-unused-unneeded-initial-statevars` here and similarly below.

> +  and --warn-unneeded-initial-statevars-lambda, which report, for
> +  clause heads and lambda expressions respectively, when an argument
> +  of the form !.SV in their argument list is never updated. In most cases,
> +  changing such arguments into non-statevars will improve the code
> +  by avoiding giving readers of the code a false expectation of an update.
> +  (An exception is when a !.SV argument is not updated in one clause,
> +  but is updated in another clause.) Both options are on by default.
> +
> +* We have added two new options, --warn-unneeded-final-statevars,
> +  and --warn-unneeded-final-statevars-lambda, which report, for
> +  clause heads and lambda expressions respectively, when an argument
> +  of the form !:SV in their argument list is guaranteed to be unified
> +  with the !.SV argument in the same argument list. In the absence of
> +  constraints that require keeping the predicate signature unchanged
> +  (e.g. to allow the predicate to be passed to a higher order construct),
> +  the !:SV argument should be deleted, and if the only use of the !.SV
> +  argument was to set the value of the !:SV argument, then the !.SV
> +  argument should be deleted too. Both options are on by default.

That's fine otherwise.

Julien.


More information about the reviews mailing list