On Wednesday, 2 April 2014 at 22:06:53 UTC, Walter Bright wrote:
Here's Andrei's proposal:

    extern (C++) template nspace() {
        int foo();
    }

@namespace("nspace")
extern (C++) {
  int 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.

If we have partial C++ bindings, why not have partial template bindings with a subset of features already existing in D? With that you would only need to implement mangling and linking. An interesting and simple enough use case is casting:

extern(C++) T my_cast(T,U)(U);
extern(C++) interface A{}
extern(C++) interface B:A{}

A a;
B b = my_cast!B(a);

Reply via email to