Is there any good reason why C++ namespaces are "closed" in D?

Manu turkeyman at gmail.com
Wed Aug 1 16:53:43 UTC 2018


On Wed, 1 Aug 2018 at 02:10, Walter Bright via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On 7/31/2018 3:34 PM, Laeeth Isharc wrote:
> > On Saturday, 28 July 2018 at 01:03:10 UTC, Walter Bright wrote:
> >> On 7/27/2018 4:15 PM, Laeeth Isharc wrote:
> >>> Can you think of a pragmatic solution to Atila's problem?
> >>
> >> One way is for the C++ => D translator to gather all the members of a
> >> namespace before trying to emit them. Since D does not impose an order on
> >> declarations (unlike C++) it is not constrained to follow the same order.
> >
> > So a new post preprocessor stage that parses the produced D code and regroups to
> > group the declarations in the same namespace together ?  Using DMD as a library
> > or libdparse or something?
>
> I don't know how Atila's translator works.
>
> The htod one that I wrote would read and do the semantic processing on the
> entire file before walking the data structures and emitting the corresponding D
> code, so grouping the namespace declarations would be trivial. In fact, due to
> the nature of semantic processing, they would already be grouped together.

None of this nuisance for Atila is necessary. You're just making
busy-work for him at someone else's expense.
Justify the design, and why it's worth the material cost to the users.


More information about the Digitalmars-d mailing list