Either I'm just too stupid, or D is lacking something
Wolfgang Draxinger
wdraxinger at darkstargames.de
Tue Jul 25 02:31:23 PDT 2006
Andrei Khropov wrote:
> Looks like we have only '@' symbol to use.
Looks nice, too.
> What you are talking about is actually more powerful
> metaprogramming. I'm afraid it's postponed to D 2.0.
Sad, that would have made my engine's source code, especially in
the renderer part a lot of shorter and readable.
But may I make a suggestion for D 1.0 here, that would at least
allow usage as I have in mind, i.e. using template mixins as a
stock function generator, by adding following rule to templates:
If a template only contains functions of the name of the
template, and the function declarations adhere the overloading
rules the template is a multifunction template.
Example:
template Foo (T, V, U)
{
void Foo(T t,V v){...}
V Foo(T t){...}
U Foo(V v){...}
};
mixin Foo!(int, bool, float) bar; // ok, no ambiguties
bar(1, 2.0);
bool a = bar(2);
float b = bar(true);
minxin Foo!(int, int, bool) foobar; // error: T and V conflict in
// ambigue function parameters, that can't overload.
Wolfgang Draxinger
--
E-Mail address works, Jabber: hexarith at jabber.org, ICQ: 134682867
GPG key FP: 2FC8 319E C7D7 1ADC 0408 65C6 05F5 A645 1FD3 BD3E
More information about the Digitalmars-d
mailing list