From zoltan.somogyi at runbox.com Mon Dec 9 05:47:21 2024 From: zoltan.somogyi at runbox.com (Zoltan Somogyi) Date: Mon, 09 Dec 2024 05:47:21 +1100 (AEDT) Subject: [m-dev.] question about warnings for should-be-singleton-but-aren't variables Message-ID: 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? Zoltan. From jfischer at opturion.com Mon Dec 9 08:36:12 2024 From: jfischer at opturion.com (Julien Fischer) Date: Mon, 9 Dec 2024 08:36:12 +1100 Subject: [m-dev.] question about warnings for should-be-singleton-but-aren't variables In-Reply-To: References: Message-ID: Hi Zoltan, You forgot to attach the diff. Julien. On Mon, 9 Dec 2024 at 05:47, Zoltan Somogyi 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? > > Zoltan. > _______________________________________________ > developers mailing list > developers at lists.mercurylang.org > https://lists.mercurylang.org/listinfo/developers From zoltan.somogyi at runbox.com Mon Dec 9 11:52:10 2024 From: zoltan.somogyi at runbox.com (Zoltan Somogyi) Date: Mon, 09 Dec 2024 11:52:10 +1100 (AEDT) Subject: [m-dev.] question about warnings for should-be-singleton-but-aren't variables In-Reply-To: References: Message-ID: On Mon, 9 Dec 2024 08:36:12 +1100, Julien Fischer wrote: > You forgot to attach the diff. Sorry about that. It is attached now. Zoltan. -------------- next part -------------- A non-text attachment was scrubbed... Name: DIFF.sbs Type: application/octet-stream Size: 5497 bytes Desc: not available URL: From zoltan.somogyi at runbox.com Mon Dec 9 18:36:45 2024 From: zoltan.somogyi at runbox.com (Zoltan Somogyi) Date: Mon, 09 Dec 2024 18:36:45 +1100 (AEDT) Subject: [m-dev.] =?utf-8?q?question_about_warnings_for_should-be-singleto?= =?utf-8?q?n-but-aren=27t=09variables?= In-Reply-To: References: Message-ID: On Mon, 09 Dec 2024 05:47:21 +1100 (AEDT), "Zoltan Somogyi" 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? 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. Zoltan. From jfischer at opturion.com Mon Dec 9 23:25:50 2024 From: jfischer at opturion.com (Julien Fischer) Date: Mon, 9 Dec 2024 23:25:50 +1100 Subject: [m-dev.] question about warnings for should-be-singleton-but-aren't variables In-Reply-To: References: Message-ID: On Mon, 9 Dec 2024 at 18:36, Zoltan Somogyi wrote: > > On Mon, 09 Dec 2024 05:47:21 +1100 (AEDT), "Zoltan Somogyi" 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.