[m-dev.] question about warnings for should-be-singleton-but-aren't variables

Julien Fischer jfischer at opturion.com
Mon Dec 9 23:25:50 AEDT 2024


On Mon, 9 Dec 2024 at 18:36, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
>
> On Mon, 09 Dec 2024 05:47:21 +1100 (AEDT), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
>
> > The attached diff describes a potential problem with
> > how we generate warnings for variables whose names start
> > with an underscore, but which occur more than once.
> > The new test case in the diff exhibits the issue, and asks
> > the question. The language manual does not explicitly say
> > what the answer should be either. What do you guys think?
>
> I thought of a way to resolve the issue that is better than either
> answer to the question in the attached-later diff. It is to split
> the existing --warn-singleton-vars option into two. The new option,
> possibly named --warn-non-singleton-vars, would control whether
> mmc reports variables whose names start with an underscore,
> which says that they *should* be singletons, that actually are not,
> while the --warn-singleton vars would new control *only* whether
> we report variables whose names do NOT start with an underscore,
> but nevertheless are singletons. These two options would be
> controllable separately in disable_warning scopes.
>
> Would anyone object to this approach?

No objections from me.

> And does anyone have
> a better name than --warn-non-singleton-vars? That name is slightly
> misleading, but as far as non-misleading names go, the shortest
> I can think of is --warn-should-be-singleton-but-arent-vars,
> which is too long.

--warn-repeated-singleton-vars?

Julien.


More information about the developers mailing list