extern(C++, NS)
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Sun Nov 29 04:59:13 PST 2015
On 11/29/2015 05:57 AM, Walter Bright wrote:
>
> D does not support C++ semantics. You cannot split namespaces into
> multiple files in D, nor can you add symbols to an existing namespace.
> For namespace NS, all the declarations in NS have to be in one file and
> between the { }, just like any other scope in D.
>
It's about namespace overloading.
The following works, even though no scopes are actually extended with
new symbols.
module other;
template foo(){ // a scope
void foo(){}
}
// ----
import other;
alias foo=other.foo;
template foo(){ // another scope
void foo(int){}
}
void main(){
foo(); // successful
foo(2); // ditto
}
More information about the Digitalmars-d
mailing list