http://d.puremagic.com/issues/show_bug.cgi?id=2599





------- Comment #4 from and...@metalanguage.com  2009-01-25 09:09 -------
(In reply to comment #3)
> > When instantiated explicitly, all explicit arguments are eaten by 
> > T1.  This is the purpose of the pattern: pass some explicit 
> > arguments, then deduce some more implicitly.
> 
> In the current template system, a template is instantiated either implicitly 
> or
> explicitly - no in-between.

Try this at home:

void fun(T1, T2)(T2 x)
{
}

void main()
{
    fun!(int)("a");
}


> To allow part-explicit, part-implicit template instantiations like you're
> asking for would be in itself a change in the language that must come first.

Already has (incidentally at my request.) It's used in much of std.algorithm.

> > Currently this is possible, but only with one ellipsis.
> 
> I'm not sure what you mean by this....

This works:

void fun(T1, T2, T3...)(T2 x, T3 xs)
{
}

void main()
{
    fun!(int)("a");
}

This doesn't, which is another bug:

void fun(T1, T2...)(T2 xs)
{
}

void main()
{
    fun!(int)("a");
}


> BTW your workaround can be written more simply:
> 
>     template f(T1...) {
>         void f(T2...)(T2 args) { ... }
>     }

Thanks!


-- 

Reply via email to