[m-dev.] new option for library modules

Peter Wang novalazy at gmail.com
Tue Dec 21 10:56:19 AEDT 2021


On Mon, 20 Dec 2021 18:57:08 +1100 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> We could help prevent issues such as the one that caused the
> most recent problem reported on m-users if we added an option,
> called maybe --this-is-mercury-stdlib-module, that behaved like this:
> 
> - If it is off, the default, then it would generate a warning if the
>   name of the module compiled with is on the list of the names of
>   Mercury standard library modules.
> 
> - If it is off, which it would be in our library directory, it would generate
>   a warning if the name of the module compiled with it is *not*
>   on that list.
> 
> The second part would ensure that the list is not missing any entries.
> 
> The list could have two halves, the publicly documented modules
> vs the rest, so that the warning in the first case could be a bit more
> expansive in the second case.
> 
> One minor issue is that this would make adding a new module
> to the library a two-step process: either add the name to the list,
> then add the module, or add the module while disabling this option
> for it, then later undo the disabling.
> 
> Opinions?

The second part sounds really annoying. If we must have this,
I suggest the option is named, say, --warn-redefine-stdlib-module,
which can be enabled by default, but disabled in the library directory.

Peter


More information about the developers mailing list