Games people play

Walter Bright newshound at digitalmars.com
Tue Oct 3 22:04:03 PDT 2006


Bill Baxter wrote:
> Yes.  For statically checked S&S, templates & mixins seem like they 
> provide basically all that is needed to implement a good solution, 
> (maybe there's still some weak reference business that needs to be 
> sorted out, but it looks like it's mostly there).  The main wart is that 
> you have to have a different template for each number of arguments, 
> resulting in repetitive code.  Some form of Variadic Templates would be 
> very nice to have there.
> 
> So instead of
> template Signal(T1) // for one argument ...
> template Signal(T1, T2) // for two arguments ...
> template Signal(T1, T2, T3) // for three arguments ...
> template Signal(T1, T2, T3, T4) // for four arguments ...
> template Signal(T1, T2, T3, T4, T5) // for five arguments ...
> template Signal(T1, T2, T3, T4, T5, T6) // for six arguments ...
> template Signal(etc...
> 
> You can just have one template
> template Signal(...) // for any number of arguments ...

That would be better, but the user doesn't see that code, just the 
library implementer. So it isn't so bad.

> But something more is needed for Dynamic Qt-like S&S.  Some sort of 
> compile-time introspection seems a minimal requirement.  I think some 
> way to tag particular method like Qt's "slot:" keyword will also be 
> necessary to make it usable.  Anyway you need some way to say "do 
> something with this method" and do it at the point of declaration rather 
> than in the constructor or elsewhere.

I don't understand. Exactly what needs to be done at compile time that 
can't be done with the mixin method?



More information about the Digitalmars-d mailing list