Specifying C++ symbols in C++ namespaces
Walter Bright
newshound2 at digitalmars.com
Sun Apr 6 13:17:10 PDT 2014
On 4/6/2014 12:39 PM, "Ola Fosheim Grøstad"
<ola.fosheim.grostad+dlang at gmail.com>" wrote:
> On Saturday, 5 April 2014 at 23:26:30 UTC, Walter Bright wrote:
>> I feel that C++ messed up namespace design because:
>>
>> 1. namespaces are not closed
>> 2. they have no relationship with modules
>
> Namespaces are not as powerful as they could have been, but being able to add
> symbols to an external scope (like classes) is very useful if done right (e.g.
> cross-cutting enhancements, adding members to external classes like
> "saveyourself", "printyourself").
It's seriously wrong to allow such. It makes a larger code base nearly
impossible to reliably reason about, leading one to rely on conventions like
"don't add stuff to namespaces".
D has closed scopes, and members can be "added" to external classes just fine,
using CTFE.
More information about the Digitalmars-d
mailing list