DIP61: Add namespaces to D

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 26 15:55:04 PDT 2014


On Saturday, 26 April 2014 at 18:13:00 UTC, Walter Bright wrote:
> On 4/26/2014 8:19 AM, Timon Gehr wrote:
>> Well, the proposed feature does not add any new capabilities 
>> except proper
>> mangling. In pure D code
>>
>> namespace foo{
>>     // declarations
>> }
>>
>> would be basically the same as
>>
>> private mixin template Foo(){
>>     // declarations
>> }
>> mixin Foo foo;
>
> That's right.
>
>> which is available today. I guess namespaces will occur in 
>> pure D code as
>> sparsely as the above construction, because they are not 
>> particularly useful.
>
> Yeah, template mixins turned out to be a solution looking for a 
> problem.

template mixins are great.

Nitpick: If they could (optionally) truly inject themselves in a 
scope (useful for automatically generating function overloads / 
constructors) then they would be even better.


More information about the Digitalmars-d mailing list