DIP61: Add namespaces to D

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 26 02:55:59 PDT 2014


On 2014-04-26 11:31, Walter Bright wrote:
> http://wiki.dlang.org/DIP61
>
> Best practices in C++ code increasingly means putting functions and
> declarations in namespaces. Currently, there is no support in D to call
> C++ functions in namespaces. The primary issue is that the name mangling
> doesn't match. Need a simple and straightforward method of indicating
> namespaces.
>
> There have been many proposals earlier:
>
>    http://forum.dlang.org/post/lhi1lt$269h$1@digitalmars.com
>
> but it seems to me that the simplest, most straightforward approach
> would be better.
>
> As more and more people are attempting to call C++ libraries from D,
> this is getting to be a more and more important issue.

I don't think it's worth adding a completely new keyword for this feature.

Even though many here will hate it I'll say it anyway, yet another 
feature that could be implemented with AST macros. There's even an 
example for just C++ namespaces [1].

[1] http://wiki.dlang.org/DIP50#C.2B.2B_Namespaces_.28issue_7961.29

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list