extern(C++, ns)

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 19 14:14:42 PST 2016


On 1/19/2016 1:40 PM, Walter Bright wrote:
> On 1/19/2016 12:29 PM, David Nadlinger wrote:
>> It's fine if you just say "I had a hunch that the added complexity would be
>> worth it by making some situations more convenient, even though I can't provide
>> a concrete example". Of course that might not be particularly persuasive, but
>> it's your call in the end. But if you keep dodging the question, this discussion
>> will never come to an end.
>
> I have answered "why not use modules" many times. I have answered the other
> questions, too.
>
> Please do not conflate not agreeing with my answers with not responding.

Oh what the hell. I'll answer it one last time:

1. C++ has namespaces. They went and invented a whole 'nother thing called 
modules. Evidently not even they think that modules and namespaces are the same 
thing.

2. Multiple modules cannot have the same name in D. C++ practice is to litter 
code with namespaces using the same name.

3. Modules have ModuleInfos, static constructors/destructors, etc. These do not 
make obvious sense for namespaces.

4. Modules and files have a 1:1 correspondence. This does not work for namespaces.

5. "extern (C++) module std" ? Ugh.

6. Modules do not nest. Namespaces nest.

7. Module semantics are independent of where they are imported. Not so for 
namespaces.

I.e. if modules were bludgeoned into being namespaces, there would be such a 
list of special cases and confusions and exceptions and awkward crap you'd be 
far, far better off having namespace as a SEPARATE feature, because that's what 
they'd wind up being anyway, even if they were named "modules".




More information about the Digitalmars-d mailing list