Games people play

Pragma ericanderton at yahoo.removeme.com
Wed Oct 4 07:25:45 PDT 2006


Walter Bright wrote:
> 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.

Perhaps, but then what happens when I need to use more arguments than 
such a template library provides for?  Suddenly, the problem is thrown 
in the library user's lap.

-- 
- EricAnderton at yahoo



More information about the Digitalmars-d mailing list