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.

Reply via email to