Date: Tue, 16 Aug 2022 08:46:27 +1000
> Why do you need a shorter way to say that? Namespace names and module
> names probably *shouldn't* always be the same. It would make it
> difficult to use sub-modules, where multiple modules contribute to one
> larger module.
They don't have to be the same, that's just the way I write my code.
On Tue, Aug 16, 2022 at 12:01 AM Jason McKesson via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> On Mon, Aug 15, 2022 at 3:46 AM Zopolis0 via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > In short-- I propose that there should be a way (if not multiple) to
> export functions within a namespace from a module without having to wrap
> the functions in a namespace block.
> > A few possibilities for the syntax of doing so are presented below,
> along with the rationale.
> > Suggestions for alternative/additional syntaxes or improvements on the
> ones proposed would be welcome.
> > Briefly:
> > Instead of
> > export module foo;
> >
> > export namespace foo
> > {
> > void bar();
> > }
> > Allow the usage of
> > export module foo;
> > export namespace foo void bar();
> >
> > Haven't really decided on the breadth of the syntax and how many ways
> there would be to declare the namespace, was thinking about a file-wide
> namespace declaration along the lines of:
> > export module foo:
> > export namespace foo;
> > This would set everything exported from module foo to be in namespace
> foo.
>
> Why do you need a shorter way to say that? Namespace names and module
> names probably *shouldn't* always be the same. It would make it
> difficult to use sub-modules, where multiple modules contribute to one
> larger module.
>
> > This of course would not work for multiple namespaces in a file, for
> which the original keyword proposition could be used as a fallback.
> >
> > Rationale:
> > Namespaces are cool. (I see no reason to provide a rationale for the
> usage of namespaces in this proposal.)
> > When using headers, it is quite easy to make the functions accessible
> through namespaces without wrapping the entire file in a namespace block.
> Simply wrap the list of functions in the header in a namespace block and
> prepend the namespace onto the functions in the file.
> >
> >
> > With modules, one has to wrap the entire file in a namespace block, or
> at least the functions they want to export, which is sub-par.
>
> Why is that "sub-par"?
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
> names probably *shouldn't* always be the same. It would make it
> difficult to use sub-modules, where multiple modules contribute to one
> larger module.
They don't have to be the same, that's just the way I write my code.
On Tue, Aug 16, 2022 at 12:01 AM Jason McKesson via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> On Mon, Aug 15, 2022 at 3:46 AM Zopolis0 via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > In short-- I propose that there should be a way (if not multiple) to
> export functions within a namespace from a module without having to wrap
> the functions in a namespace block.
> > A few possibilities for the syntax of doing so are presented below,
> along with the rationale.
> > Suggestions for alternative/additional syntaxes or improvements on the
> ones proposed would be welcome.
> > Briefly:
> > Instead of
> > export module foo;
> >
> > export namespace foo
> > {
> > void bar();
> > }
> > Allow the usage of
> > export module foo;
> > export namespace foo void bar();
> >
> > Haven't really decided on the breadth of the syntax and how many ways
> there would be to declare the namespace, was thinking about a file-wide
> namespace declaration along the lines of:
> > export module foo:
> > export namespace foo;
> > This would set everything exported from module foo to be in namespace
> foo.
>
> Why do you need a shorter way to say that? Namespace names and module
> names probably *shouldn't* always be the same. It would make it
> difficult to use sub-modules, where multiple modules contribute to one
> larger module.
>
> > This of course would not work for multiple namespaces in a file, for
> which the original keyword proposition could be used as a fallback.
> >
> > Rationale:
> > Namespaces are cool. (I see no reason to provide a rationale for the
> usage of namespaces in this proposal.)
> > When using headers, it is quite easy to make the functions accessible
> through namespaces without wrapping the entire file in a namespace block.
> Simply wrap the list of functions in the header in a namespace block and
> prepend the namespace onto the functions in the file.
> >
> >
> > With modules, one has to wrap the entire file in a namespace block, or
> at least the functions they want to export, which is sub-par.
>
> Why is that "sub-par"?
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2022-08-15 22:46:41