Template namespaces - Obsolete?
Janice Caron
caron800 at googlemail.com
Wed Sep 19 12:23:36 PDT 2007
Now that we can do:
class A(T);
struct A(T);
union A(T);
T func(T)(T x);
static int func(int n);
...
etc.
Is there any need, any more, for the old fashioned
template t(T)
{
int f();
int g();
}
and having to refer to t!(T).f() and t!(T).g() ?
I almost think it would suffice to complete the new notation with
obvious extensions like
typedef(T) something t; /* == template t(T) { typedef something t; } */
alias(T) something t; /* == template t(T) { typedef something t; } */
enum(T) t : T {...}; /* == template t(T) { enum t : T {...}; } */
int a(int N)[N]; /* == template a(int N) { int a[N]; } */
(Not too sure about the usefulness of that last one, but I include if
for completion).
and then deprecate the old namespace notation.
The namespace notation is very useful for defining mixins though, and
perhaps that has now become its primary purpose. If that functionality
is ever replaced by "macro", what then?
More information about the Digitalmars-d
mailing list