Why can't templates use tuples for for argument types?

Bill Baxter dnewsgroup at billbaxter.com
Wed Jul 18 18:37:12 PDT 2007


Jarrett Billingsley wrote:
> "Bill Baxter" <dnewsgroup at billbaxter.com> wrote in message 
> news:f7m9k9$es4$1 at digitalmars.com...
>> Rather than proposing a bunch of new syntax, isn't the solution just to 
>> make those things work as expected?  If you want at least one thing it 
>> seems perfectly reasonable to me to do:
>>
>> template Foo(A, B...) {
>>    alias Tuple!(A,B) ArgTuple;
>>    ...
>> }
> 
> Well the issue is that an identifier as a template parameter already has a 
> well-defined meaning - it's a type parameter.  Changing it to allow anything 
> seems awfully scary, hence the suggestions for new syntax. 


Yeh I meant for the A to be a type there.
I guess I just don't understand the use case for BCS's original example:

   template Foo(A, B...) {}

   these should work

   Foo!(1, int);
   Foo!(int, 1);
   Foo!(Foo!(int, 1));


If you don't even know what kind of entity a thing is, there's not much 
you can do with it.

Anyway, since it's been a basically a dialogue between you and BCS so 
far, something tells me you haven't hit a nerve with many folks.  My 
guess is that most folks aren't clear what the motivating use case is. 
And probably Walter isn't going to be much interested in this either 
without good use case examples.

--bb


More information about the Digitalmars-d-learn mailing list