Specifying C++ symbols in C++ namespaces

Mike none at none.com
Wed Apr 2 16:04:56 PDT 2014


On Wednesday, 2 April 2014 at 22:06:53 UTC, Walter Bright wrote:
> Here's Andrei's proposal:
>
>     extern (C++) template nspace() {
>         int foo();
>     }
>
> It would be accessed in D by:
>
>    nspace!().foo();
>
> A possible enhancement would be to allow (for all templates 
> with no parameters):
>
>     nspace.foo();
>
> Note that:
>
>     template nspace() {
>         extern (C++) int foo();
>     }
>
> would not put foo() in a C++ namespace, although it would still 
> be accessed from D as:
>
>     nspace.foo();
>
> One downside of this proposal is that if we ever (perish the 
> thought!) attempted to interface to C++ templates, this design 
> would preclude that.

Walter, some on this list have not been around long enough to 
understand the motivation for this.  Could you please summarize 
the problem and how this addresses it? Is this for interfacing D 
to C++, or a way to bring namespace semantics to D?

Mike


More information about the Digitalmars-d mailing list