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
}

Reply via email to