Date: Fri, 3 Nov 2023 22:58:40 -0700
On Fri, Nov 3, 2023 at 11:44 AM Ben Boeckel via SG15 <sg15_at_[hidden]>
wrote:
> On Fri, Nov 03, 2023 at 12:39:35 -0400, Tom Honermann via SG15 wrote:
> > Please correct me if I'm mistaken, but at this point, module names are
> > used only to map a /module-import-declaration/ to a corresponding
> > /module-declaration/ (in another translation unit) and we have no actual
> > proposals to use module names for any other purposes. If so, then my
> > only hesitation with prohibiting use of macros for module names is
> > whether there might be more motivation for configurable module names in
> > the future.
> >
> > I can only think of two reasons to support configurable module names at
> > present:
> >
> > 1. To allow module names to be changed without breaking backward
> > compatibility:
> > import Twitter.api; -> import X.api;
> > 2. To allow a generic module name to be resolved to one of multiple
> > module providers:
> > import ldap.provider;
>
> This reminds me…Bjarne's "profiles" proposals are likely to introduce
> macros here as well:
>
> #define MY_PROJECT_SAFETY_PROFILES [[profile(safety_a)]]
> // …
> export module X MY_PROJECT_SAFETY_PROFILES;
>
> The grammar rules may ban this for scanning. Of course, if we're going
> to say that attributes cannot affect BMI matters, then we can ignore
> them. If they affect BMI usage (e.g., if `import X;` needs a different
> BMI than `import X [[profile(thread_safety)]];`), then we will still
> likely need macros. Or a good story for users as to why *these*
> attributes must be typed by hand/generated code and not
> preprocessor-selected.
>
> I do need to ask Bjarne about the semantic meaning of these profile
> attributes to the BMI.
>
> --Ben
>
>
The grammar is specifically crafted to still allow this use case.
Attributes can have any impact on the module as long as they don't change
the final token sequence used to `import` them. The only thing you need the
name for is to map from an `import` to source file to command line for that
source file. As long as that works it's all good, even changing the module
name used for mangling is fine.
- Michael Spencer
wrote:
> On Fri, Nov 03, 2023 at 12:39:35 -0400, Tom Honermann via SG15 wrote:
> > Please correct me if I'm mistaken, but at this point, module names are
> > used only to map a /module-import-declaration/ to a corresponding
> > /module-declaration/ (in another translation unit) and we have no actual
> > proposals to use module names for any other purposes. If so, then my
> > only hesitation with prohibiting use of macros for module names is
> > whether there might be more motivation for configurable module names in
> > the future.
> >
> > I can only think of two reasons to support configurable module names at
> > present:
> >
> > 1. To allow module names to be changed without breaking backward
> > compatibility:
> > import Twitter.api; -> import X.api;
> > 2. To allow a generic module name to be resolved to one of multiple
> > module providers:
> > import ldap.provider;
>
> This reminds me…Bjarne's "profiles" proposals are likely to introduce
> macros here as well:
>
> #define MY_PROJECT_SAFETY_PROFILES [[profile(safety_a)]]
> // …
> export module X MY_PROJECT_SAFETY_PROFILES;
>
> The grammar rules may ban this for scanning. Of course, if we're going
> to say that attributes cannot affect BMI matters, then we can ignore
> them. If they affect BMI usage (e.g., if `import X;` needs a different
> BMI than `import X [[profile(thread_safety)]];`), then we will still
> likely need macros. Or a good story for users as to why *these*
> attributes must be typed by hand/generated code and not
> preprocessor-selected.
>
> I do need to ask Bjarne about the semantic meaning of these profile
> attributes to the BMI.
>
> --Ben
>
>
The grammar is specifically crafted to still allow this use case.
Attributes can have any impact on the module as long as they don't change
the final token sequence used to `import` them. The only thing you need the
name for is to map from an `import` to source file to command line for that
source file. As long as that works it's all good, even changing the module
name used for mangling is fine.
- Michael Spencer
Received on 2023-11-04 05:58:55