[m-rev.] for post-commit review: do singleton warnings for *all* foreign_procs in a module

Peter Wang novalazy at gmail.com
Fri Jan 30 15:25:21 AEDT 2026


On Thu, 29 Jan 2026 22:09:28 +1100 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> Warn about singletons for *all* foreign procs.


> diff --git a/library/io.environment.m b/library/io.environment.m
> index 9ec671bef..9ef534dbe 100644
> --- a/library/io.environment.m
> +++ b/library/io.environment.m
> @@ -343,13 +343,18 @@ record_env_var_and_value(EnvVarName, EnvVarValue, !EnvVarAL) :-
>  ").
>  
>  :- pragma foreign_proc("Java",
> -    setenv(Var::in, Value::in),
> +    setenv(_Var::in, _Value::in),
>      [will_not_call_mercury, tabled_for_io, may_not_duplicate],
>  "
> -    // Java does not provide a method to set environment variables, only a way
> -    // to modify the environment when creating a new process.
> -
> -    // Avoid warning: Var, Value
> +    // Java does not provide a method to set environment variables
> +    // in the CURRENT process; it provides a way to modify the environment
> +    // only when creating a NEW process.
> +    //
> +    // XXX The original version of the above comment was added by wangp
> +    // in 2009. Based on why I (zs) have read about this online in 2026,
> +    // this seems to be a design decision by the creators of Java. Even
> +    // though it may have made sense in 1995, it seems to me to be stupid
> +    // to idea to maintain it long past the time when it buys you anything.
>      SUCCESS_INDICATOR = false;
>  ").

The last sentence is ungrammatical.

The rest looks fine.

Peter


More information about the reviews mailing list