Overlapping functionality: IFTI, templates, is-expressions
Russell Lewis
webmaster at villagersonline.com
Sat Mar 22 18:56:16 PDT 2008
Bill Baxter wrote:
> Are you saying templates don't need to overload across modules? If so,
> what is the D alternative to the non-intrusive traits template pattern
> used in C++?
I tried, but I failed, to shortcut that rabbit trail. So let me take
the next step, and repeat the subtle problems with silent cross-module
overloading.
The problem comes about when two different programmers, in different
libraries, write templates with the same name. Say that programmer A
writes a template foo with two specializations:
BEGIN CODE
template foo(int A,TPL...) { ... }
template foo(TPL...) { ... }
END CODE
Now, ages later, when somebody links that with another library, we find
this template:
BEGIN CODE
template foo(char c,TPL...) { ... }
END CODE
Now, when you use the template:
alias foo!('c') myTemplateInstance;
which library are you trying to use?
More information about the Digitalmars-d
mailing list