Andrei's list of barriers to D adoption

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 7 10:54:32 PDT 2016


On Tuesday, 7 June 2016 at 17:38:01 UTC, Ola Fosheim Grøstad 
wrote:
> On Tuesday, 7 June 2016 at 17:04:19 UTC, jmh530 wrote:
>> How about no headers or macros?
>
> Textual include files are annoying and C++ needs more symbolic 
> modules, but not having the ability to use namespaces is 
> annoying too and D's take on name resolution can break code.

Maybe I should explain the namespace part, as what I am referring 
to is a relatively new feature in C++ called "inline namespaces".

I basically do this in different include files:


namespace mylib {
     inline namespace common {
         // stuff I want to use without prefix or with ::mylib::*
     }
     // stuff I want to use with prefix ::mylib::*
}


When I include various parts of mylib I simply write

"use namespace ::mylib::common;"

Then all symbols in ::mylib::common is accessible without 
prefixing it, but I can choose to use explicit prefixing 
::mylib::... whenever I want to anyway.

Handy for not polluting the namespace, but also getting easy 
access to things often used in conditional like "is_empty(x)".

Not sure if other people do this, but I like it.



More information about the Digitalmars-d mailing list